diff options
author | 2021-08-10 07:52:45 +0530 | |
---|---|---|
committer | 2021-08-10 07:52:45 +0530 | |
commit | cfaa5ee25c094a96e106ce0bf657f8cd6a59b867 (patch) | |
tree | f3bc6623e181d849440339ad84b01a285a8b4c5a /src/lib | |
parent | 5.6.1-nightly.20 [skip ci] (diff) | |
download | ferdium-app-cfaa5ee25c094a96e106ce0bf657f8cd6a59b867.tar.gz ferdium-app-cfaa5ee25c094a96e106ce0bf657f8cd6a59b867.tar.zst ferdium-app-cfaa5ee25c094a96e106ce0bf657f8cd6a59b867.zip |
refactor: Use symbols for key shortcuts
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Menu.js | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index db592b478..7c69ddea7 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -6,7 +6,7 @@ import { autorun, observable } from 'mobx'; | |||
6 | import { defineMessages } from 'react-intl'; | 6 | import { defineMessages } from 'react-intl'; |
7 | import { CUSTOM_WEBSITE_RECIPE_ID, GITHUB_FERDI_URL, LIVE_API_FERDI_WEBSITE } from '../config'; | 7 | import { CUSTOM_WEBSITE_RECIPE_ID, GITHUB_FERDI_URL, LIVE_API_FERDI_WEBSITE } from '../config'; |
8 | import { | 8 | import { |
9 | cmdKey, isLinux, isMac, aboutAppDetails, | 9 | cmdKey, altKey, shiftKey, isLinux, isMac, aboutAppDetails, |
10 | } from '../environment'; | 10 | } from '../environment'; |
11 | import { announcementsStore } from '../features/announcements'; | 11 | import { announcementsStore } from '../features/announcements'; |
12 | import { announcementActions } from '../features/announcements/actions'; | 12 | import { announcementActions } from '../features/announcements/actions'; |
@@ -318,7 +318,7 @@ function getActiveWebview() { | |||
318 | const _titleBarTemplateFactory = (intl, locked) => [ | 318 | const _titleBarTemplateFactory = (intl, locked) => [ |
319 | { | 319 | { |
320 | label: intl.formatMessage(menuItems.edit), | 320 | label: intl.formatMessage(menuItems.edit), |
321 | accelerator: 'Alt+E', | 321 | accelerator: `${altKey}+E`, |
322 | submenu: [ | 322 | submenu: [ |
323 | { | 323 | { |
324 | label: intl.formatMessage(menuItems.undo), | 324 | label: intl.formatMessage(menuItems.undo), |
@@ -348,7 +348,7 @@ const _titleBarTemplateFactory = (intl, locked) => [ | |||
348 | }, | 348 | }, |
349 | { | 349 | { |
350 | label: intl.formatMessage(menuItems.pasteAndMatchStyle), | 350 | label: intl.formatMessage(menuItems.pasteAndMatchStyle), |
351 | accelerator: `${cmdKey}+Shift+V`, // Override the accelerator since this adds new key combo in macos | 351 | accelerator: `${cmdKey}+${shiftKey}+V`, // Override the accelerator since this adds new key combo in macos |
352 | role: 'pasteAndMatchStyle', | 352 | role: 'pasteAndMatchStyle', |
353 | click() { | 353 | click() { |
354 | getActiveWebview().pasteAndMatchStyle(); | 354 | getActiveWebview().pasteAndMatchStyle(); |
@@ -367,7 +367,7 @@ const _titleBarTemplateFactory = (intl, locked) => [ | |||
367 | }, | 367 | }, |
368 | { | 368 | { |
369 | label: intl.formatMessage(menuItems.view), | 369 | label: intl.formatMessage(menuItems.view), |
370 | accelerator: 'Alt+V', | 370 | accelerator: `${altKey}+V`, |
371 | visible: !locked, | 371 | visible: !locked, |
372 | submenu: [ | 372 | submenu: [ |
373 | { | 373 | { |
@@ -463,7 +463,7 @@ const _titleBarTemplateFactory = (intl, locked) => [ | |||
463 | { | 463 | { |
464 | label: intl.formatMessage(menuItems.toggleDarkMode), | 464 | label: intl.formatMessage(menuItems.toggleDarkMode), |
465 | type: 'checkbox', | 465 | type: 'checkbox', |
466 | accelerator: `${cmdKey}+Shift+D`, | 466 | accelerator: `${cmdKey}+${shiftKey}+D`, |
467 | checked: window.ferdi.stores.settings.app.darkMode, | 467 | checked: window.ferdi.stores.settings.app.darkMode, |
468 | click: () => { | 468 | click: () => { |
469 | window.ferdi.actions.settings.update({ | 469 | window.ferdi.actions.settings.update({ |
@@ -478,13 +478,13 @@ const _titleBarTemplateFactory = (intl, locked) => [ | |||
478 | }, | 478 | }, |
479 | { | 479 | { |
480 | label: intl.formatMessage(menuItems.services), | 480 | label: intl.formatMessage(menuItems.services), |
481 | accelerator: 'Alt+S', | 481 | accelerator: `${altKey}+S`, |
482 | visible: !locked, | 482 | visible: !locked, |
483 | submenu: [], | 483 | submenu: [], |
484 | }, | 484 | }, |
485 | { | 485 | { |
486 | label: intl.formatMessage(menuItems.workspaces), | 486 | label: intl.formatMessage(menuItems.workspaces), |
487 | accelerator: 'Alt+W', | 487 | accelerator: `${altKey}+W`, |
488 | submenu: [], | 488 | submenu: [], |
489 | visible: !locked && workspaceStore.isFeatureEnabled, | 489 | visible: !locked && workspaceStore.isFeatureEnabled, |
490 | }, | 490 | }, |
@@ -509,7 +509,7 @@ const _titleBarTemplateFactory = (intl, locked) => [ | |||
509 | }, | 509 | }, |
510 | { | 510 | { |
511 | label: intl.formatMessage(menuItems.help), | 511 | label: intl.formatMessage(menuItems.help), |
512 | accelerator: 'Alt+H', | 512 | accelerator: `${altKey}+H`, |
513 | role: 'help', | 513 | role: 'help', |
514 | submenu: [ | 514 | submenu: [ |
515 | { | 515 | { |
@@ -612,13 +612,13 @@ export default class FranzMenu { | |||
612 | type: 'separator', | 612 | type: 'separator', |
613 | }, { | 613 | }, { |
614 | label: intl.formatMessage(menuItems.toggleDevTools), | 614 | label: intl.formatMessage(menuItems.toggleDevTools), |
615 | accelerator: `${cmdKey}+Alt+I`, | 615 | accelerator: `${cmdKey}+${altKey}+I`, |
616 | click: (menuItem, browserWindow) => { | 616 | click: (menuItem, browserWindow) => { |
617 | browserWindow.webContents.toggleDevTools(); | 617 | browserWindow.webContents.toggleDevTools(); |
618 | }, | 618 | }, |
619 | }, { | 619 | }, { |
620 | label: intl.formatMessage(menuItems.toggleServiceDevTools), | 620 | label: intl.formatMessage(menuItems.toggleServiceDevTools), |
621 | accelerator: `${cmdKey}+Shift+Alt+I`, | 621 | accelerator: `${cmdKey}+${shiftKey}+${altKey}+I`, |
622 | click: () => { | 622 | click: () => { |
623 | this.actions.service.openDevToolsForActiveService(); | 623 | this.actions.service.openDevToolsForActiveService(); |
624 | }, | 624 | }, |
@@ -628,7 +628,7 @@ export default class FranzMenu { | |||
628 | if (this.stores.features.features.isTodosEnabled) { | 628 | if (this.stores.features.features.isTodosEnabled) { |
629 | tpl[1].submenu.push({ | 629 | tpl[1].submenu.push({ |
630 | label: intl.formatMessage(menuItems.toggleTodosDevTools), | 630 | label: intl.formatMessage(menuItems.toggleTodosDevTools), |
631 | accelerator: `${cmdKey}+Shift+Alt+O`, | 631 | accelerator: `${cmdKey}+${shiftKey}+${altKey}+O`, |
632 | click: () => { | 632 | click: () => { |
633 | const webview = document.querySelector('#todos-panel webview'); | 633 | const webview = document.querySelector('#todos-panel webview'); |
634 | if (webview) this.actions.todos.openDevTools(); | 634 | if (webview) this.actions.todos.openDevTools(); |
@@ -654,13 +654,13 @@ export default class FranzMenu { | |||
654 | }, | 654 | }, |
655 | }, { | 655 | }, { |
656 | label: intl.formatMessage(menuItems.reloadFerdi), | 656 | label: intl.formatMessage(menuItems.reloadFerdi), |
657 | accelerator: `${cmdKey}+Shift+R`, | 657 | accelerator: `${cmdKey}+${shiftKey}+R`, |
658 | click: () => { | 658 | click: () => { |
659 | window.location.reload(); | 659 | window.location.reload(); |
660 | }, | 660 | }, |
661 | }, { | 661 | }, { |
662 | label: intl.formatMessage(menuItems.reloadTodos), | 662 | label: intl.formatMessage(menuItems.reloadTodos), |
663 | accelerator: `${cmdKey}+Shift+Alt+R`, | 663 | accelerator: `${cmdKey}+${shiftKey}+${altKey}+R`, |
664 | click: () => { | 664 | click: () => { |
665 | this.actions.todos.reload(); | 665 | this.actions.todos.reload(); |
666 | }, | 666 | }, |
@@ -668,7 +668,7 @@ export default class FranzMenu { | |||
668 | type: 'separator', | 668 | type: 'separator', |
669 | }, { | 669 | }, { |
670 | label: intl.formatMessage(menuItems.lockFerdi), | 670 | label: intl.formatMessage(menuItems.lockFerdi), |
671 | accelerator: `${cmdKey}+Shift+L`, | 671 | accelerator: `${cmdKey}+${shiftKey}+L`, |
672 | enabled: this.stores.user.isLoggedIn && this.stores.settings.app.lockingFeatureEnabled, | 672 | enabled: this.stores.user.isLoggedIn && this.stores.settings.app.lockingFeatureEnabled, |
673 | click() { | 673 | click() { |
674 | actions.settings.update({ | 674 | actions.settings.update({ |
@@ -696,7 +696,7 @@ export default class FranzMenu { | |||
696 | 696 | ||
697 | tpl[0].submenu.unshift({ | 697 | tpl[0].submenu.unshift({ |
698 | label: intl.formatMessage(menuItems.touchId), | 698 | label: intl.formatMessage(menuItems.touchId), |
699 | accelerator: `${cmdKey}+Shift+L`, | 699 | accelerator: `${cmdKey}+${shiftKey}+L`, |
700 | visible: touchIdEnabled, | 700 | visible: touchIdEnabled, |
701 | click() { | 701 | click() { |
702 | systemPreferences.promptTouchID(intl.formatMessage(menuItems.touchIdPrompt)).then(() => { | 702 | systemPreferences.promptTouchID(intl.formatMessage(menuItems.touchIdPrompt)).then(() => { |
@@ -716,7 +716,7 @@ export default class FranzMenu { | |||
716 | 716 | ||
717 | tpl.unshift({ | 717 | tpl.unshift({ |
718 | label: isMac ? app.name : intl.formatMessage(menuItems.file), | 718 | label: isMac ? app.name : intl.formatMessage(menuItems.file), |
719 | accelerator: 'Alt+F', | 719 | accelerator: `${altKey}+F`, |
720 | submenu: [ | 720 | submenu: [ |
721 | { | 721 | { |
722 | label: intl.formatMessage(menuItems.about), | 722 | label: intl.formatMessage(menuItems.about), |
@@ -888,24 +888,24 @@ export default class FranzMenu { | |||
888 | visible: !cmdAltShortcutsVisibile, | 888 | visible: !cmdAltShortcutsVisibile, |
889 | }, { | 889 | }, { |
890 | label: intl.formatMessage(menuItems.activateNextService), | 890 | label: intl.formatMessage(menuItems.activateNextService), |
891 | accelerator: `${cmdKey}+alt+right`, | 891 | accelerator: `${cmdKey}+${altKey}+right`, |
892 | click: () => this.actions.service.setActiveNext(), | 892 | click: () => this.actions.service.setActiveNext(), |
893 | visible: cmdAltShortcutsVisibile, | 893 | visible: cmdAltShortcutsVisibile, |
894 | }, { | 894 | }, { |
895 | label: intl.formatMessage(menuItems.activatePreviousService), | 895 | label: intl.formatMessage(menuItems.activatePreviousService), |
896 | accelerator: `${cmdKey}+shift+tab`, | 896 | accelerator: `${cmdKey}+${shiftKey}+tab`, |
897 | click: () => this.actions.service.setActivePrev(), | 897 | click: () => this.actions.service.setActivePrev(), |
898 | visible: !cmdAltShortcutsVisibile, | 898 | visible: !cmdAltShortcutsVisibile, |
899 | }, { | 899 | }, { |
900 | label: intl.formatMessage(menuItems.activatePreviousService), | 900 | label: intl.formatMessage(menuItems.activatePreviousService), |
901 | accelerator: `${cmdKey}+alt+left`, | 901 | accelerator: `${cmdKey}+${altKey}+left`, |
902 | click: () => this.actions.service.setActivePrev(), | 902 | click: () => this.actions.service.setActivePrev(), |
903 | visible: cmdAltShortcutsVisibile, | 903 | visible: cmdAltShortcutsVisibile, |
904 | }, { | 904 | }, { |
905 | label: intl.formatMessage( | 905 | label: intl.formatMessage( |
906 | settings.all.app.isAppMuted ? menuItems.unmuteApp : menuItems.muteApp, | 906 | settings.all.app.isAppMuted ? menuItems.unmuteApp : menuItems.muteApp, |
907 | ).replace('&', '&&'), | 907 | ).replace('&', '&&'), |
908 | accelerator: `${cmdKey}+shift+m`, | 908 | accelerator: `${cmdKey}+${shiftKey}+m`, |
909 | click: () => this.actions.app.toggleMuteApp(), | 909 | click: () => this.actions.app.toggleMuteApp(), |
910 | }, { | 910 | }, { |
911 | type: 'separator', | 911 | type: 'separator', |
@@ -930,7 +930,7 @@ export default class FranzMenu { | |||
930 | type: 'separator', | 930 | type: 'separator', |
931 | }, { | 931 | }, { |
932 | label: intl.formatMessage(menuItems.serviceGoHome), | 932 | label: intl.formatMessage(menuItems.serviceGoHome), |
933 | accelerator: `${cmdKey}+shift+H`, | 933 | accelerator: `${cmdKey}+${shiftKey}+H`, |
934 | click: () => this.actions.service.reloadActive(), | 934 | click: () => this.actions.service.reloadActive(), |
935 | }); | 935 | }); |
936 | } | 936 | } |
@@ -946,7 +946,7 @@ export default class FranzMenu { | |||
946 | // Add new workspace item: | 946 | // Add new workspace item: |
947 | menu.push({ | 947 | menu.push({ |
948 | label: intl.formatMessage(menuItems.addNewWorkspace), | 948 | label: intl.formatMessage(menuItems.addNewWorkspace), |
949 | accelerator: `${cmdKey}+Shift+N`, | 949 | accelerator: `${cmdKey}+${shiftKey}+N`, |
950 | click: () => { | 950 | click: () => { |
951 | workspaceActions.openWorkspaceSettings(); | 951 | workspaceActions.openWorkspaceSettings(); |
952 | }, | 952 | }, |
@@ -975,7 +975,7 @@ export default class FranzMenu { | |||
975 | // Default workspace | 975 | // Default workspace |
976 | menu.push({ | 976 | menu.push({ |
977 | label: intl.formatMessage(menuItems.defaultWorkspace), | 977 | label: intl.formatMessage(menuItems.defaultWorkspace), |
978 | accelerator: `${cmdKey}+Alt+0`, | 978 | accelerator: `${cmdKey}+${altKey}+0`, |
979 | type: 'radio', | 979 | type: 'radio', |
980 | checked: !activeWorkspace, | 980 | checked: !activeWorkspace, |
981 | click: () => { | 981 | click: () => { |
@@ -986,7 +986,7 @@ export default class FranzMenu { | |||
986 | // Workspace items | 986 | // Workspace items |
987 | workspaces.forEach((workspace, i) => menu.push({ | 987 | workspaces.forEach((workspace, i) => menu.push({ |
988 | label: workspace.name, | 988 | label: workspace.name, |
989 | accelerator: i < 9 ? `${cmdKey}+Alt+${i + 1}` : null, | 989 | accelerator: i < 9 ? `${cmdKey}+${altKey}+${i + 1}` : null, |
990 | type: 'radio', | 990 | type: 'radio', |
991 | checked: activeWorkspace ? workspace.id === activeWorkspace.id : false, | 991 | checked: activeWorkspace ? workspace.id === activeWorkspace.id : false, |
992 | click: () => { | 992 | click: () => { |