Skip to content

Commit

Permalink
feat: option to use Alt to activate service
Browse files Browse the repository at this point in the history
  • Loading branch information
dxrcy committed Nov 18, 2024
1 parent efc6680 commit 83cd5c8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
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

0 comments on commit 83cd5c8

Please sign in to comment.