diff options
author | 2019-03-07 17:18:44 +0100 | |
---|---|---|
committer | 2019-03-07 17:25:48 +0100 | |
commit | 1df3342534ae100d732ad57c9eae7401e5e97a83 (patch) | |
tree | df6b86879b9ecb30938d69776b4dce4b76e11dd8 /src/lib | |
parent | fix(Service) shortcuts for activating prev/next service fixes #1298 (diff) | |
download | ferdium-app-1df3342534ae100d732ad57c9eae7401e5e97a83.tar.gz ferdium-app-1df3342534ae100d732ad57c9eae7401e5e97a83.tar.zst ferdium-app-1df3342534ae100d732ad57c9eae7401e5e97a83.zip |
fix(Service): Fix shortcut for (un)muting notifications & audio
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Menu.js | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/lib/Menu.js b/src/lib/Menu.js index 7bdbd9159..fb92644d0 100644 --- a/src/lib/Menu.js +++ b/src/lib/Menu.js | |||
@@ -187,6 +187,14 @@ const menuItems = defineMessages({ | |||
187 | id: 'menu.services.activatePreviousService', | 187 | id: 'menu.services.activatePreviousService', |
188 | defaultMessage: '!!!Activate previous service...', | 188 | defaultMessage: '!!!Activate previous service...', |
189 | }, | 189 | }, |
190 | muteApp: { | ||
191 | id: 'sidebar.muteApp', | ||
192 | defaultMessage: '!!!Disable notifications & audio', | ||
193 | }, | ||
194 | unmuteApp: { | ||
195 | id: 'sidebar.unmuteApp', | ||
196 | defaultMessage: '!!!Enable notifications & audio', | ||
197 | }, | ||
190 | }); | 198 | }); |
191 | 199 | ||
192 | function getActiveWebview() { | 200 | function getActiveWebview() { |
@@ -416,7 +424,7 @@ const _titleBarTemplateFactory = intl => [ | |||
416 | }, | 424 | }, |
417 | { | 425 | { |
418 | label: intl.formatMessage(menuItems.zoomIn), | 426 | label: intl.formatMessage(menuItems.zoomIn), |
419 | accelerator: `${ctrlKey}+Plus`, | 427 | accelerator: `${ctrlKey}+=`, |
420 | click() { | 428 | click() { |
421 | const activeService = getActiveWebview(); | 429 | const activeService = getActiveWebview(); |
422 | activeService.getZoomLevel((level) => { | 430 | activeService.getZoomLevel((level) => { |
@@ -702,34 +710,38 @@ export default class FranzMenu { | |||
702 | 710 | ||
703 | @computed get serviceTpl() { | 711 | @computed get serviceTpl() { |
704 | const { intl } = window.franz; | 712 | const { intl } = window.franz; |
705 | const services = this.stores.services.allDisplayed; | 713 | const { user, services, settings } = this.stores; |
706 | const menu = [{ | 714 | if (!user.isLoggedIn) return []; |
715 | const menu = []; | ||
716 | |||
717 | menu.push({ | ||
707 | label: intl.formatMessage(menuItems.addNewService), | 718 | label: intl.formatMessage(menuItems.addNewService), |
708 | accelerator: `${cmdKey}+N`, | 719 | accelerator: `${cmdKey}+N`, |
709 | click: () => { | 720 | click: () => { |
710 | this.actions.ui.openSettings({ path: 'recipes' }); | 721 | this.actions.ui.openSettings({ path: 'recipes' }); |
711 | }, | 722 | }, |
712 | enabled: this.stores.user.isLoggedIn, | ||
713 | }, { | 723 | }, { |
714 | type: 'separator', | 724 | type: 'separator', |
715 | }, { | 725 | }, { |
716 | label: intl.formatMessage(menuItems.activateNextService), | 726 | label: intl.formatMessage(menuItems.activateNextService), |
717 | accelerator: `${cmdKey}+alt+right`, | 727 | accelerator: `${cmdKey}+alt+right`, |
718 | click: () => this.actions.service.setActiveNext(), | 728 | click: () => this.actions.service.setActiveNext(), |
719 | enabled: this.stores.user.isLoggedIn, | ||
720 | }, { | 729 | }, { |
721 | label: intl.formatMessage(menuItems.activatePreviousService), | 730 | label: intl.formatMessage(menuItems.activatePreviousService), |
722 | accelerator: `${cmdKey}+alt+left`, | 731 | accelerator: `${cmdKey}+alt+left`, |
723 | click: () => this.actions.service.setActivePrev(), | 732 | click: () => this.actions.service.setActivePrev(), |
724 | enabled: this.stores.user.isLoggedIn, | 733 | }, { |
734 | label: intl.formatMessage( | ||
735 | settings.all.app.isAppMuted ? menuItems.unmuteApp : menuItems.muteApp, | ||
736 | ).replace('&', '&&'), | ||
737 | accelerator: `${cmdKey}+shift+m`, | ||
738 | click: () => this.actions.app.toggleMuteApp(), | ||
725 | }, { | 739 | }, { |
726 | type: 'separator', | 740 | type: 'separator', |
727 | }]; | 741 | }); |
728 | |||
729 | menu.push(); | ||
730 | 742 | ||
731 | if (this.stores.user.isLoggedIn) { | 743 | if (this.stores.user.isLoggedIn) { |
732 | services.forEach((service, i) => (menu.push({ | 744 | services.allDisplayed.forEach((service, i) => (menu.push({ |
733 | label: this._getServiceName(service), | 745 | label: this._getServiceName(service), |
734 | accelerator: i < 9 ? `${cmdKey}+${i + 1}` : null, | 746 | accelerator: i < 9 ? `${cmdKey}+${i + 1}` : null, |
735 | type: 'radio', | 747 | type: 'radio', |