Skip to content

Commit

Permalink
Preferences Help add shortcut
Browse files Browse the repository at this point in the history
Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
  • Loading branch information
torchiaf committed Jan 10, 2023
1 parent b018981 commit 7a766b5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pkg/rancher-desktop/window/preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { app, dialog } from 'electron';

import { webRoot, createWindow } from '.';

import { Help } from '@pkg/config/help';
import { NavItemName } from '@pkg/config/transientSettings';
import { Shortcuts } from '@pkg/utils/shortcuts';
import { getVersion } from '@pkg/utils/version';

interface NavItems {
name: NavItemName;
Expand Down Expand Up @@ -43,6 +46,24 @@ export function openPreferences() {
},
});

if (!Shortcuts.isRegistered(window)) {
Shortcuts.register(
window,
[{
key: '?',
meta: true,
platform: 'darwin',
}, {
key: 'F1',
platform: ['win32', 'linux'],
}],
async() => {
Help.preferences.openUrl(await getVersion());
},
'preferences help',
);
}

window.webContents.on('ipc-message', (_event, channel) => {
if (channel === 'preferences/load') {
window.show();
Expand Down

0 comments on commit 7a766b5

Please sign in to comment.