Add riot-desktop shortcuts for forward/back matching browsers&slack
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
6e15684a04
commit
2346829055
3 changed files with 62 additions and 1 deletions
|
@ -233,6 +233,16 @@ ipcMain.on('ipcCall', async function(ev, payload) {
|
||||||
case 'getConfig':
|
case 'getConfig':
|
||||||
ret = vectorConfig;
|
ret = vectorConfig;
|
||||||
break;
|
break;
|
||||||
|
case 'navigateBack':
|
||||||
|
if (mainWindow.webContents.canGoBack()) {
|
||||||
|
mainWindow.webContents.goBack();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'navigateForward':
|
||||||
|
if (mainWindow.webContents.canGoForward()) {
|
||||||
|
mainWindow.webContents.goForward();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
mainWindow.webContents.send('ipcReply', {
|
mainWindow.webContents.send('ipcReply', {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
"Unable to load config file: please refresh the page to try again.": "Unable to load config file: please refresh the page to try again.",
|
"Unable to load config file: please refresh the page to try again.": "Unable to load config file: please refresh the page to try again.",
|
||||||
"Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.",
|
"Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.",
|
||||||
"Open user settings": "Open user settings",
|
"Open user settings": "Open user settings",
|
||||||
|
"Previous/next recently visited room or community": "Previous/next recently visited room or community",
|
||||||
"Riot Desktop on %(platformName)s": "Riot Desktop on %(platformName)s",
|
"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",
|
"Go to your browser to complete Sign In": "Go to your browser to complete Sign In",
|
||||||
"Unknown device": "Unknown device",
|
"Unknown device": "Unknown device",
|
||||||
|
|
|
@ -218,7 +218,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
this.startUpdateCheck = this.startUpdateCheck.bind(this);
|
this.startUpdateCheck = this.startUpdateCheck.bind(this);
|
||||||
this.stopUpdateCheck = this.stopUpdateCheck.bind(this);
|
this.stopUpdateCheck = this.stopUpdateCheck.bind(this);
|
||||||
|
|
||||||
// register Mac specific shortcuts
|
// register OS-specific shortcuts
|
||||||
if (isMac) {
|
if (isMac) {
|
||||||
registerShortcut(Categories.NAVIGATION, {
|
registerShortcut(Categories.NAVIGATION, {
|
||||||
keybinds: [{
|
keybinds: [{
|
||||||
|
@ -227,6 +227,28 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
}],
|
}],
|
||||||
description: _td("Open user settings"),
|
description: _td("Open user settings"),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
registerShortcut(Categories.NAVIGATION, {
|
||||||
|
keybinds: [{
|
||||||
|
modifiers: [Modifiers.COMMAND],
|
||||||
|
key: Key.SQUARE_BRACKET_LEFT,
|
||||||
|
}, {
|
||||||
|
modifiers: [Modifiers.COMMAND],
|
||||||
|
key: Key.SQUARE_BRACKET_RIGHT,
|
||||||
|
}],
|
||||||
|
description: _td("Previous/next recently visited room or community"),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
registerShortcut(Categories.NAVIGATION, {
|
||||||
|
keybinds: [{
|
||||||
|
modifiers: [Modifiers.ALT],
|
||||||
|
key: Key.ARROW_LEFT,
|
||||||
|
}, {
|
||||||
|
modifiers: [Modifiers.ALT],
|
||||||
|
key: Key.ARROW_RIGHT,
|
||||||
|
}],
|
||||||
|
description: _td("Previous/next recently visited room or community"),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,4 +456,32 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||||
description: <Spinner />,
|
description: <Spinner />,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_navigateForwardBack(back: boolean) {
|
||||||
|
this._ipcCall(back ? "navigateBack" : "navigateForward");
|
||||||
|
}
|
||||||
|
|
||||||
|
onKeyDown(ev: KeyboardEvent): boolean {
|
||||||
|
let handled = false;
|
||||||
|
|
||||||
|
switch (ev.key) {
|
||||||
|
case Key.SQUARE_BRACKET_LEFT:
|
||||||
|
case Key.SQUARE_BRACKET_RIGHT:
|
||||||
|
if (isMac && ev.metaKey && !ev.altKey && !ev.ctrlKey && !ev.shiftKey) {
|
||||||
|
this._navigateForwardBack(ev.key === Key.SQUARE_BRACKET_LEFT);
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Key.ARROW_LEFT:
|
||||||
|
case Key.ARROW_RIGHT:
|
||||||
|
if (!isMac && ev.altKey && !ev.metaKey && !ev.ctrlKey && !ev.shiftKey) {
|
||||||
|
this._navigateForwardBack(ev.key === Key.ARROW_LEFT);
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue