mirror of https://github.com/keeweb/keeweb
fix #565: global shortcut to open KeeWeb
parent
cc9e369b6f
commit
5a8927b547
|
@ -24,7 +24,8 @@ const globalShortcuts = {
|
|||
copyUser: { mac: 'Ctrl+Alt+B', all: 'Shift+Alt+B' },
|
||||
copyUrl: { mac: 'Ctrl+Alt+U', all: 'Shift+Alt+U' },
|
||||
copyOtp: {},
|
||||
autoType: { mac: 'Ctrl+Alt+T', all: 'Shift+Alt+T' }
|
||||
autoType: { mac: 'Ctrl+Alt+T', all: 'Shift+Alt+T' },
|
||||
restoreApp: {}
|
||||
};
|
||||
|
||||
const Shortcuts = {
|
||||
|
|
|
@ -43,7 +43,8 @@ class SettingsShortcutsView extends View {
|
|||
copyPassword: Shortcuts.globalShortcutText('copyPassword', true),
|
||||
copyUser: Shortcuts.globalShortcutText('copyUser', true),
|
||||
copyUrl: Shortcuts.globalShortcutText('copyUrl', true),
|
||||
copyOtp: Shortcuts.globalShortcutText('copyOtp', true)
|
||||
copyOtp: Shortcuts.globalShortcutText('copyOtp', true),
|
||||
restoreApp: Shortcuts.globalShortcutText('restoreApp', true)
|
||||
}
|
||||
: undefined
|
||||
});
|
||||
|
|
|
@ -30,5 +30,7 @@
|
|||
data-shortcut="copyUrl">{{{globalShortcuts.copyUrl}}}</button> {{res 'setShCopyUrlGlobal'}}</div>
|
||||
<div><button class="shortcut btn-silent {{#if globalIsLarge}}shortcut-large{{/if}}"
|
||||
data-shortcut="copyOtp">{{{globalShortcuts.copyOtp}}}</button> {{res 'setShCopyOtpGlobal'}}</div>
|
||||
<div><button class="shortcut btn-silent {{#if globalIsLarge}}shortcut-large{{/if}}"
|
||||
data-shortcut="restoreApp">{{{globalShortcuts.restoreApp}}}</button> {{#res 'menuRestoreApp'}}KeeWeb{{/res}}</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
|
|
@ -402,17 +402,22 @@ function setGlobalShortcuts(appSettings) {
|
|||
CopyPassword: { shortcut: defaultShortcutModifiers + 'C', event: 'copy-password' },
|
||||
CopyUser: { shortcut: defaultShortcutModifiers + 'B', event: 'copy-user' },
|
||||
CopyUrl: { shortcut: defaultShortcutModifiers + 'U', event: 'copy-url' },
|
||||
CopyOtp: { event: 'copy-otp' }
|
||||
CopyOtp: { event: 'copy-otp' },
|
||||
RestoreApp: { action: restoreMainWindow }
|
||||
};
|
||||
electron.globalShortcut.unregisterAll();
|
||||
for (const [key, shortcutDef] of Object.entries(defaultShortcuts)) {
|
||||
const fromSettings = appSettings[`globalShortcut${key}`];
|
||||
const shortcut = fromSettings || shortcutDef.shortcut;
|
||||
const eventName = shortcutDef.event;
|
||||
if (shortcut) {
|
||||
try {
|
||||
electron.globalShortcut.register(shortcut, () => {
|
||||
emitRemoteEvent(eventName);
|
||||
if (shortcutDef.event) {
|
||||
emitRemoteEvent(shortcutDef.event);
|
||||
}
|
||||
if (shortcutDef.action) {
|
||||
shortcutDef.action();
|
||||
}
|
||||
});
|
||||
} catch (e) {}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ Release notes
|
|||
`-` #1022: fuzzy search
|
||||
`+` #1108: setting for running in an iframe
|
||||
`+` #963: keyboard shortcut to copy OTP in background
|
||||
`+` #565: global shortcut to open KeeWeb
|
||||
`-` fix #1273: untranslated menu items
|
||||
|
||||
##### v1.11.6 (2019-10-04)
|
||||
|
|
Loading…
Reference in New Issue