Skip to content
Permalink
Browse files

fix(Service): Fix shortcut for (un)muting notifications & audio

  • Loading branch information...
DominikGuzei committed Mar 7, 2019
1 parent a73e6bd commit 1df3342534ae100d732ad57c9eae7401e5e97a83
Showing with 48 additions and 40 deletions.
  1. +0 −5 package-lock.json
  2. +0 −1 package.json
  3. +26 −0 src/i18n/messages/src/lib/Menu.json
  4. +22 −10 src/lib/Menu.js
  5. +0 −24 src/stores/AppStore.js

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -53,7 +53,6 @@
"fs-extra": "7.0.1",
"hex-to-rgba": "1.0.2",
"jsonwebtoken": "^7.4.1",
"keymaster": "^1.6.2",
"lodash": "^4.17.4",
"mdi": "^1.9.33",
"mime-types": "2.1.21",
@@ -583,5 +583,31 @@
"line": 189,
"column": 3
}
},
{
"id": "sidebar.muteApp",
"defaultMessage": "!!!Disable notifications & audio",
"file": "src/lib/Menu.js",
"start": {
"line": 190,
"column": 11
},
"end": {
"line": 193,
"column": 3
}
},
{
"id": "sidebar.unmuteApp",
"defaultMessage": "!!!Enable notifications & audio",
"file": "src/lib/Menu.js",
"start": {
"line": 194,
"column": 13
},
"end": {
"line": 197,
"column": 3
}
}
]
@@ -187,6 +187,14 @@ const menuItems = defineMessages({
id: 'menu.services.activatePreviousService',
defaultMessage: '!!!Activate previous service...',
},
muteApp: {
id: 'sidebar.muteApp',
defaultMessage: '!!!Disable notifications & audio',
},
unmuteApp: {
id: 'sidebar.unmuteApp',
defaultMessage: '!!!Enable notifications & audio',
},
});

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

@computed get serviceTpl() {
const { intl } = window.franz;
const services = this.stores.services.allDisplayed;
const menu = [{
const { user, services, settings } = this.stores;
if (!user.isLoggedIn) return [];
const menu = [];

menu.push({
label: intl.formatMessage(menuItems.addNewService),
accelerator: `${cmdKey}+N`,
click: () => {
this.actions.ui.openSettings({ path: 'recipes' });
},
enabled: this.stores.user.isLoggedIn,
}, {
type: 'separator',
}, {
label: intl.formatMessage(menuItems.activateNextService),
accelerator: `${cmdKey}+alt+right`,
click: () => this.actions.service.setActiveNext(),
enabled: this.stores.user.isLoggedIn,
}, {
label: intl.formatMessage(menuItems.activatePreviousService),
accelerator: `${cmdKey}+alt+left`,
click: () => this.actions.service.setActivePrev(),
enabled: this.stores.user.isLoggedIn,
}, {
label: intl.formatMessage(
settings.all.app.isAppMuted ? menuItems.unmuteApp : menuItems.muteApp,
).replace('&', '&&'),
accelerator: `${cmdKey}+shift+m`,
click: () => this.actions.app.toggleMuteApp(),
}, {
type: 'separator',
}];

menu.push();
});

if (this.stores.user.isLoggedIn) {
services.forEach((service, i) => (menu.push({
services.allDisplayed.forEach((service, i) => (menu.push({
label: this._getServiceName(service),
accelerator: i < 9 ? `${cmdKey}+${i + 1}` : null,
type: 'radio',
@@ -3,7 +3,6 @@ import {
action, computed, observable, reaction,
} from 'mobx';
import moment from 'moment';
import key from 'keymaster';
import { getDoNotDisturb } from '@meetfranz/electron-notification-state';
import AutoLaunch from 'auto-launch';
import prettyBytes from 'pretty-bytes';
@@ -157,28 +156,6 @@ export default class AppStore extends Store {
this.stores.router.push(url);
});


// Global Mute
key(
'⌘+shift+m ctrl+shift+m', () => {
this.actions.app.toggleMuteApp();
},
);

// We need to add an additional key listener for ctrl+ on windows. Otherwise only ctrl+shift+ would work
if (isWindows) {
key(
'ctrl+=', () => {
debug('Windows: zoom in via ctrl+');
const { webview } = this.stores.services.active;
webview.getZoomLevel((level) => {
// level 9 =~ +300% and setZoomLevel wouldnt zoom in further
if (level < 9) webview.setZoomLevel(level + 1);
});
},
);
}

this.locale = this._getDefaultLocale();

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

@action _muteApp({ isMuted, overrideSystemMute = true }) {
this.isSystemMuteOverridden = overrideSystemMute;

this.actions.settings.update({
type: 'app',
data: {

0 comments on commit 1df3342

Please sign in to comment.
You can’t perform that action at this time.