forked from matrix/element-web
Register Mac electron specific Cmd+, shortcut to User Settings
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
775e1fc4ae
commit
3d266cb237
|
@ -40,6 +40,11 @@ const template = [
|
|||
{ role: 'zoomin', accelerator: 'CommandOrControl+=' },
|
||||
{ role: 'zoomout' },
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: 'Preferences',
|
||||
accelerator: 'Command+,', // Mac-only accelerator
|
||||
click() { global.mainWindow.webContents.send('preferences'); },
|
||||
},
|
||||
{ role: 'togglefullscreen' },
|
||||
{ role: 'toggledevtools' },
|
||||
],
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.",
|
||||
"Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.": "Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url.",
|
||||
"Invalid configuration: no default server specified.": "Invalid configuration: no default server specified.",
|
||||
"Open user settings": "Open user settings",
|
||||
"Riot Desktop on %(platformName)s": "Riot Desktop on %(platformName)s",
|
||||
"Go to your browser to complete Sign In": "Go to your browser to complete Sign In",
|
||||
"Unknown device": "Unknown device",
|
||||
|
|
|
@ -23,15 +23,29 @@ limitations under the License.
|
|||
import VectorBasePlatform, {updateCheckStatusEnum} from './VectorBasePlatform';
|
||||
import BaseEventIndexManager from 'matrix-react-sdk/src/indexing/BaseEventIndexManager';
|
||||
import dis from 'matrix-react-sdk/src/dispatcher';
|
||||
import { _t } from 'matrix-react-sdk/src/languageHandler';
|
||||
import { _t, _td } from 'matrix-react-sdk/src/languageHandler';
|
||||
import * as rageshake from 'matrix-react-sdk/src/rageshake/rageshake';
|
||||
import {MatrixClient} from "matrix-js-sdk";
|
||||
import Modal from "matrix-react-sdk/src/Modal";
|
||||
import InfoDialog from "matrix-react-sdk/src/components/views/dialogs/InfoDialog";
|
||||
import Spinner from "matrix-react-sdk/src/components/views/elements/Spinner";
|
||||
import {Categories, Modifiers, registerShortcut} from "matrix-react-sdk/src/accessibility/KeyboardShortcuts";
|
||||
import {Key} from "matrix-react-sdk/src/Keyboard";
|
||||
import React from "react";
|
||||
|
||||
const ipcRenderer = window.ipcRenderer;
|
||||
const isMac = navigator.platform.toUpperCase().includes('MAC');
|
||||
|
||||
// register Mac specific shortcuts
|
||||
if (isMac) {
|
||||
registerShortcut(Categories.NAVIGATION, {
|
||||
keybinds: [{
|
||||
modifiers: [Modifiers.COMMAND],
|
||||
key: Key.COMMA,
|
||||
}],
|
||||
description: _td("Open user settings"),
|
||||
});
|
||||
}
|
||||
|
||||
function platformFriendlyName(): string {
|
||||
// used to use window.process but the same info is available here
|
||||
|
@ -208,6 +222,10 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
|||
ipcRenderer.on('ipcReply', this._onIpcReply.bind(this));
|
||||
ipcRenderer.on('update-downloaded', this.onUpdateDownloaded.bind(this));
|
||||
|
||||
ipcRenderer.on('preferences', () => {
|
||||
dis.dispatch({ action: 'view_user_settings' });
|
||||
});
|
||||
|
||||
this.startUpdateCheck = this.startUpdateCheck.bind(this);
|
||||
this.stopUpdateCheck = this.stopUpdateCheck.bind(this);
|
||||
}
|
||||
|
@ -301,7 +319,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
|||
|
||||
supportsAutoHideMenuBar(): boolean {
|
||||
// This is irelevant on Mac as Menu bars don't live in the app window
|
||||
return !navigator.platform.toUpperCase().includes('MAC');
|
||||
return !isMac;
|
||||
}
|
||||
|
||||
async getAutoHideMenuBarEnabled(): boolean {
|
||||
|
@ -314,7 +332,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
|||
|
||||
supportsMinimizeToTray(): boolean {
|
||||
// Things other than Mac support tray icons
|
||||
return !navigator.platform.toUpperCase().includes('MAC');
|
||||
return !isMac;
|
||||
}
|
||||
|
||||
async getMinimizeToTrayEnabled(): boolean {
|
||||
|
|
Loading…
Reference in New Issue