Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: option to use Alt+[0-9] to select service #1972

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/components/services/tabs/TabItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,10 @@ class TabItem extends Component<IProps, IState> {
data-tooltip-id="tooltip-sidebar-button"
data-tooltip-content={`${service.name} ${acceleratorString({
index: shortcutIndex,
keyCombo: cmdOrCtrlShortcutKey(false),
keyCombo: this.props.stores!.settings.all.shortcuts
.activateServiceUsesAlt
? altKey()
: cmdOrCtrlShortcutKey(false),
})}`}
>
<img src={service.icon} className="tab-item__icon" alt="" />
Expand Down
2 changes: 2 additions & 0 deletions src/components/settings/settings/EditSettingsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1235,6 +1235,8 @@ class EditSettingsForm extends Component<IProps, IState> {
onChange={e => this.submit(e)}
{...form.$('shortcutActivatePreviousService').bind()}
/>

<Toggle {...form.$('activateServiceUsesAlt').bind()} />
</div>
</div>
)}
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,4 +476,5 @@ export const DEFAULT_SERVICE_SETTINGS = {
export const DEFAULT_SHORTCUTS = {
activateNextService: 'Ctrl+tab',
activatePreviousService: `Ctrl+${shiftKey()}+tab`,
activateServiceUsesAlt: false,
};
10 changes: 10 additions & 0 deletions src/containers/settings/EditSettingsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ class EditSettingsScreen extends Component<
const newShortcuts = {
activateNextService: settingsData.shortcutActivateNextService,
activatePreviousService: settingsData.shortcutActivatePreviousService,
activateServiceUsesAlt: Boolean(settingsData.activateServiceUsesAlt),
};

const requiredRestartKeys = [
Expand Down Expand Up @@ -1342,6 +1343,15 @@ class EditSettingsScreen extends Component<
default: DEFAULT_SHORTCUTS.activatePreviousService,
placeholder: DEFAULT_SHORTCUTS.activatePreviousService,
},
activateServiceUsesAlt: {
label: intl.formatMessage(menuItems.activateServiceUsesAlt),
value: ifUndefined<boolean>(
settings.all.shortcuts.activateServiceUsesAlt,
DEFAULT_SHORTCUTS.activateServiceUsesAlt,
),
default: DEFAULT_SHORTCUTS.activateServiceUsesAlt,
type: 'checkbox',
},
},
};

Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"menu.help.tos": "Terms of Service",
"menu.services": "Services",
"menu.services.activatePreviousService": "Activate previous service",
"menu.services.activateServiceUsesAlt": "Use Alt key to activate service",
"menu.services.addNewService": "Add New Service...",
"menu.services.copyToClipboard": "Copy to clipboard",
"menu.services.goHome": "Home",
Expand Down
8 changes: 7 additions & 1 deletion src/lib/Menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ export const menuItems = defineMessages({
id: 'menu.services.activatePreviousService',
defaultMessage: 'Activate previous service',
},
activateServiceUsesAlt: {
id: 'menu.services.activateServiceUsesAlt',
defaultMessage: 'Use Alt key to activate service',
},
muteApp: {
id: 'sidebar.muteApp',
defaultMessage: 'Disable notifications & audio',
Expand Down Expand Up @@ -1145,7 +1149,9 @@ class FranzMenu implements StoresProps {
label: this._getServiceName(service),
accelerator: acceleratorString({
index: i + 1,
keyCombo: cmdOrCtrlShortcutKey(),
keyCombo: this.stores.settings.shortcuts.activateServiceUsesAlt
? altKey()
: cmdOrCtrlShortcutKey(),
prefix: '',
suffix: '',
}),
Expand Down