mirror of
https://github.com/heyman/heynote.git
synced 2025-02-16 10:19:55 +01:00
Hide Heynote when global hotkey is pressed if the window is already focused
This commit is contained in:
parent
9e50446417
commit
f8678a91ec
@ -153,9 +153,16 @@ function registerGlobalHotkey() {
|
||||
if (CONFIG.get("settings.enableGlobalHotkey")) {
|
||||
try {
|
||||
const ret = globalShortcut.register(CONFIG.get("settings.globalHotkey"), () => {
|
||||
app.focus({steal: true})
|
||||
if (win?.isMinimized()) {
|
||||
win?.restore()
|
||||
if (!win) {
|
||||
return
|
||||
}
|
||||
if (win.isFocused()) {
|
||||
app.hide()
|
||||
} else {
|
||||
app.focus({steal: true})
|
||||
if (win.isMinimized()) {
|
||||
win.restore()
|
||||
}
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
|
Loading…
Reference in New Issue
Block a user