diff options
-rw-r--r-- | package-lock.json | 5 | ||||
-rw-r--r-- | package.json | 1 | ||||
-rw-r--r-- | src/i18n/messages/src/lib/Menu.json | 26 | ||||
-rw-r--r-- | src/lib/Menu.js | 32 | ||||
-rw-r--r-- | src/stores/AppStore.js | 24 |
5 files changed, 48 insertions, 40 deletions
diff --git a/package-lock.json b/package-lock.json index 82e9c9997..8499abda9 100644 --- a/package-lock.json +++ b/package-lock.json | |||
@@ -11454,11 +11454,6 @@ | |||
11454 | "integrity": "sha1-P55JkK3K0MaGwOcB92RYaPdfkes=", | 11454 | "integrity": "sha1-P55JkK3K0MaGwOcB92RYaPdfkes=", |
11455 | "dev": true | 11455 | "dev": true |
11456 | }, | 11456 | }, |
11457 | "keymaster": { | ||
11458 | "version": "1.6.2", | ||
11459 | "resolved": "https://registry.npmjs.org/keymaster/-/keymaster-1.6.2.tgz", | ||
11460 | "integrity": "sha1-4a5U0OqUiPn2C2a2aPAumhlGxus=" | ||
11461 | }, | ||
11462 | "killable": { | 11457 | "killable": { |
11463 | "version": "1.0.1", | 11458 | "version": "1.0.1", |
11464 | "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", | 11459 | "resolved": "https://registry.npmjs.org/killable/-/killable-1.0.1.tgz", |
diff --git a/package.json b/package.json index 05f10849c..14e0df7ca 100644 --- a/package.json +++ b/package.json | |||
@@ -53,7 +53,6 @@ | |||
53 | "fs-extra": "7.0.1", | 53 | "fs-extra": "7.0.1", |
54 | "hex-to-rgba": "1.0.2", | 54 | "hex-to-rgba": "1.0.2", |
55 | "jsonwebtoken": "^7.4.1", | 55 | "jsonwebtoken": "^7.4.1", |
56 | "keymaster": "^1.6.2", | ||
57 | "lodash": "^4.17.4", | 56 | "lodash": "^4.17.4", |
58 | "mdi": "^1.9.33", | 57 | "mdi": "^1.9.33", |
59 | "mime-types": "2.1.21", | 58 | "mime-types": "2.1.21", |
diff --git a/src/i18n/messages/src/lib/Menu.json b/src/i18n/messages/src/lib/Menu.json index a131851aa..9314f5cce 100644 --- a/src/i18n/messages/src/lib/Menu.json +++ b/src/i18n/messages/src/lib/Menu.json | |||
@@ -583,5 +583,31 @@ | |||
583 | "line": 189, | 583 | "line": 189, |
584 | "column": 3 | 584 | "column": 3 |
585 | } | 585 | } |
586 | }, | ||
587 | { | ||
588 | "id": "sidebar.muteApp", | ||
589 | "defaultMessage": "!!!Disable notifications & audio", | ||
590 | "file": "src/lib/Menu.js", | ||
591 | "start": { | ||
592 | "line": 190, | ||
593 | "column": 11 | ||
594 | }, | ||
595 | "end": { | ||
596 | "line": 193, | ||
597 | "column": 3 | ||
598 | } | ||
599 | }, | ||
600 | { | ||
601 | "id": "sidebar.unmuteApp", | ||
602 | "defaultMessage": "!!!Enable notifications & audio", | ||
603 | "file": "src/lib/Menu.js", | ||
604 | "start": { | ||
605 | "line": 194, | ||
606 | "column": 13 | ||
607 | }, | ||
608 | "end": { | ||
609 | "line": 197, | ||
610 | "column": 3 | ||
611 | } | ||
586 | } | 612 | } |
587 | ] \ No newline at end of file | 613 | ] \ No newline at end of file |
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', |
diff --git a/src/stores/AppStore.js b/src/stores/AppStore.js index 1db61a64e..7784ff1f9 100644 --- a/src/stores/AppStore.js +++ b/src/stores/AppStore.js | |||
@@ -3,7 +3,6 @@ import { | |||
3 | action, computed, observable, reaction, | 3 | action, computed, observable, reaction, |
4 | } from 'mobx'; | 4 | } from 'mobx'; |
5 | import moment from 'moment'; | 5 | import moment from 'moment'; |
6 | import key from 'keymaster'; | ||
7 | import { getDoNotDisturb } from '@meetfranz/electron-notification-state'; | 6 | import { getDoNotDisturb } from '@meetfranz/electron-notification-state'; |
8 | import AutoLaunch from 'auto-launch'; | 7 | import AutoLaunch from 'auto-launch'; |
9 | import prettyBytes from 'pretty-bytes'; | 8 | import prettyBytes from 'pretty-bytes'; |
@@ -157,28 +156,6 @@ export default class AppStore extends Store { | |||
157 | this.stores.router.push(url); | 156 | this.stores.router.push(url); |
158 | }); | 157 | }); |
159 | 158 | ||
160 | |||
161 | // Global Mute | ||
162 | key( | ||
163 | '⌘+shift+m ctrl+shift+m', () => { | ||
164 | this.actions.app.toggleMuteApp(); | ||
165 | }, | ||
166 | ); | ||
167 | |||
168 | // We need to add an additional key listener for ctrl+ on windows. Otherwise only ctrl+shift+ would work | ||
169 | if (isWindows) { | ||
170 | key( | ||
171 | 'ctrl+=', () => { | ||
172 | debug('Windows: zoom in via ctrl+'); | ||
173 | const { webview } = this.stores.services.active; | ||
174 | webview.getZoomLevel((level) => { | ||
175 | // level 9 =~ +300% and setZoomLevel wouldnt zoom in further | ||
176 | if (level < 9) webview.setZoomLevel(level + 1); | ||
177 | }); | ||
178 | }, | ||
179 | ); | ||
180 | } | ||
181 | |||
182 | this.locale = this._getDefaultLocale(); | 159 | this.locale = this._getDefaultLocale(); |
183 | 160 | ||
184 | this._healthCheck(); | 161 | this._healthCheck(); |
@@ -290,7 +267,6 @@ export default class AppStore extends Store { | |||
290 | 267 | ||
291 | @action _muteApp({ isMuted, overrideSystemMute = true }) { | 268 | @action _muteApp({ isMuted, overrideSystemMute = true }) { |
292 | this.isSystemMuteOverridden = overrideSystemMute; | 269 | this.isSystemMuteOverridden = overrideSystemMute; |
293 | |||
294 | this.actions.settings.update({ | 270 | this.actions.settings.update({ |
295 | type: 'app', | 271 | type: 'app', |
296 | data: { | 272 | data: { |