mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
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
@ -233,6 +233,16 @@ ipcMain.on('ipcCall', async function(ev, payload) {
|
||||
case 'getConfig':
|
||||
ret = vectorConfig;
|
||||
break;
|
||||
case 'navigateBack':
|
||||
if (mainWindow.webContents.canGoBack()) {
|
||||
mainWindow.webContents.goBack();
|
||||
}
|
||||
break;
|
||||
case 'navigateForward':
|
||||
if (mainWindow.webContents.canGoForward()) {
|
||||
mainWindow.webContents.goForward();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
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.",
|
||||
"Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.",
|
||||
"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",
|
||||
"Go to your browser to complete Sign In": "Go to your browser to complete Sign In",
|
||||
"Unknown device": "Unknown device",
|
||||
|
@ -218,7 +218,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||
this.startUpdateCheck = this.startUpdateCheck.bind(this);
|
||||
this.stopUpdateCheck = this.stopUpdateCheck.bind(this);
|
||||
|
||||
// register Mac specific shortcuts
|
||||
// register OS-specific shortcuts
|
||||
if (isMac) {
|
||||
registerShortcut(Categories.NAVIGATION, {
|
||||
keybinds: [{
|
||||
@ -227,6 +227,28 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
||||
}],
|
||||
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 />,
|
||||
});
|
||||
}
|
||||
|
||||
_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 New Issue
Block a user