Skip to content

Commit 1df3342

Browse files
committed
fix(Service): Fix shortcut for (un)muting notifications & audio
1 parent a73e6bd commit 1df3342

File tree

5 files changed

+48
-40
lines changed

5 files changed

+48
-40
lines changed

package-lock.json

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
"fs-extra": "7.0.1",
5454
"hex-to-rgba": "1.0.2",
5555
"jsonwebtoken": "^7.4.1",
56-
"keymaster": "^1.6.2",
5756
"lodash": "^4.17.4",
5857
"mdi": "^1.9.33",
5958
"mime-types": "2.1.21",

src/i18n/messages/src/lib/Menu.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,5 +583,31 @@
583583
"line": 189,
584584
"column": 3
585585
}
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+
}
586612
}
587613
]

src/lib/Menu.js

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,14 @@ const menuItems = defineMessages({
187187
id: 'menu.services.activatePreviousService',
188188
defaultMessage: '!!!Activate previous service...',
189189
},
190+
muteApp: {
191+
id: 'sidebar.muteApp',
192+
defaultMessage: '!!!Disable notifications & audio',
193+
},
194+
unmuteApp: {
195+
id: 'sidebar.unmuteApp',
196+
defaultMessage: '!!!Enable notifications & audio',
197+
},
190198
});
191199

192200
function getActiveWebview() {
@@ -416,7 +424,7 @@ const _titleBarTemplateFactory = intl => [
416424
},
417425
{
418426
label: intl.formatMessage(menuItems.zoomIn),
419-
accelerator: `${ctrlKey}+Plus`,
427+
accelerator: `${ctrlKey}+=`,
420428
click() {
421429
const activeService = getActiveWebview();
422430
activeService.getZoomLevel((level) => {
@@ -702,34 +710,38 @@ export default class FranzMenu {
702710

703711
@computed get serviceTpl() {
704712
const { intl } = window.franz;
705-
const services = this.stores.services.allDisplayed;
706-
const menu = [{
713+
const { user, services, settings } = this.stores;
714+
if (!user.isLoggedIn) return [];
715+
const menu = [];
716+
717+
menu.push({
707718
label: intl.formatMessage(menuItems.addNewService),
708719
accelerator: `${cmdKey}+N`,
709720
click: () => {
710721
this.actions.ui.openSettings({ path: 'recipes' });
711722
},
712-
enabled: this.stores.user.isLoggedIn,
713723
}, {
714724
type: 'separator',
715725
}, {
716726
label: intl.formatMessage(menuItems.activateNextService),
717727
accelerator: `${cmdKey}+alt+right`,
718728
click: () => this.actions.service.setActiveNext(),
719-
enabled: this.stores.user.isLoggedIn,
720729
}, {
721730
label: intl.formatMessage(menuItems.activatePreviousService),
722731
accelerator: `${cmdKey}+alt+left`,
723732
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(),
725739
}, {
726740
type: 'separator',
727-
}];
728-
729-
menu.push();
741+
});
730742

731743
if (this.stores.user.isLoggedIn) {
732-
services.forEach((service, i) => (menu.push({
744+
services.allDisplayed.forEach((service, i) => (menu.push({
733745
label: this._getServiceName(service),
734746
accelerator: i < 9 ? `${cmdKey}+${i + 1}` : null,
735747
type: 'radio',

src/stores/AppStore.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
action, computed, observable, reaction,
44
} from 'mobx';
55
import moment from 'moment';
6-
import key from 'keymaster';
76
import { getDoNotDisturb } from '@meetfranz/electron-notification-state';
87
import AutoLaunch from 'auto-launch';
98
import prettyBytes from 'pretty-bytes';
@@ -157,28 +156,6 @@ export default class AppStore extends Store {
157156
this.stores.router.push(url);
158157
});
159158

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-
182159
this.locale = this._getDefaultLocale();
183160

184161
this._healthCheck();
@@ -290,7 +267,6 @@ export default class AppStore extends Store {
290267

291268
@action _muteApp({ isMuted, overrideSystemMute = true }) {
292269
this.isSystemMuteOverridden = overrideSystemMute;
293-
294270
this.actions.settings.update({
295271
type: 'app',
296272
data: {

0 commit comments

Comments
 (0)