aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-03-07 17:18:44 +0100
committerLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-03-07 17:25:48 +0100
commit1df3342534ae100d732ad57c9eae7401e5e97a83 (patch)
treedf6b86879b9ecb30938d69776b4dce4b76e11dd8 /src
parentfix(Service) shortcuts for activating prev/next service fixes #1298 (diff)
downloadferdium-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')
-rw-r--r--src/i18n/messages/src/lib/Menu.json26
-rw-r--r--src/lib/Menu.js32
-rw-r--r--src/stores/AppStore.js24
3 files changed, 48 insertions, 34 deletions
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
192function getActiveWebview() { 200function 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';
5import moment from 'moment'; 5import moment from 'moment';
6import key from 'keymaster';
7import { getDoNotDisturb } from '@meetfranz/electron-notification-state'; 6import { getDoNotDisturb } from '@meetfranz/electron-notification-state';
8import AutoLaunch from 'auto-launch'; 7import AutoLaunch from 'auto-launch';
9import prettyBytes from 'pretty-bytes'; 8import 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: {