From ecdfd2ca894856066dbd9b550ee901287ed84afe Mon Sep 17 00:00:00 2001 From: darcy Date: Mon, 18 Nov 2024 12:22:00 +1100 Subject: [PATCH] feat: option to use Alt to activate service closes #1971 --- src/components/settings/settings/EditSettingsForm.tsx | 2 ++ src/config.ts | 1 + src/containers/settings/EditSettingsScreen.tsx | 10 ++++++++++ src/i18n/locales/en-US.json | 1 + src/lib/Menu.ts | 8 +++++++- 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/components/settings/settings/EditSettingsForm.tsx b/src/components/settings/settings/EditSettingsForm.tsx index 310fbfa5ec..466d9ebec5 100644 --- a/src/components/settings/settings/EditSettingsForm.tsx +++ b/src/components/settings/settings/EditSettingsForm.tsx @@ -1235,6 +1235,8 @@ class EditSettingsForm extends Component { onChange={e => this.submit(e)} {...form.$('shortcutActivatePreviousService').bind()} /> + + )} diff --git a/src/config.ts b/src/config.ts index 5c85d23439..7b46e981d1 100644 --- a/src/config.ts +++ b/src/config.ts @@ -476,4 +476,5 @@ export const DEFAULT_SERVICE_SETTINGS = { export const DEFAULT_SHORTCUTS = { activateNextService: 'Ctrl+tab', activatePreviousService: `Ctrl+${shiftKey()}+tab`, + activateServiceUsesAlt: false, }; diff --git a/src/containers/settings/EditSettingsScreen.tsx b/src/containers/settings/EditSettingsScreen.tsx index 58dd33c76e..29d62118b0 100644 --- a/src/containers/settings/EditSettingsScreen.tsx +++ b/src/containers/settings/EditSettingsScreen.tsx @@ -509,6 +509,7 @@ class EditSettingsScreen extends Component< const newShortcuts = { activateNextService: settingsData.shortcutActivateNextService, activatePreviousService: settingsData.shortcutActivatePreviousService, + activateServiceUsesAlt: Boolean(settingsData.activateServiceUsesAlt), }; const requiredRestartKeys = [ @@ -1342,6 +1343,15 @@ class EditSettingsScreen extends Component< default: DEFAULT_SHORTCUTS.activatePreviousService, placeholder: DEFAULT_SHORTCUTS.activatePreviousService, }, + activateServiceUsesAlt: { + label: intl.formatMessage(menuItems.activateServiceUsesAlt), + value: ifUndefined( + settings.all.shortcuts.activateServiceUsesAlt, + DEFAULT_SHORTCUTS.activateServiceUsesAlt, + ), + default: DEFAULT_SHORTCUTS.activateServiceUsesAlt, + type: 'checkbox', + }, }, }; diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index 30d55719e0..7f727cbad7 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json @@ -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", diff --git a/src/lib/Menu.ts b/src/lib/Menu.ts index 7bfe5ec4f6..e28d7c6b91 100644 --- a/src/lib/Menu.ts +++ b/src/lib/Menu.ts @@ -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', @@ -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: '', }),