mirror of
https://github.com/heyman/heynote.git
synced 2025-02-21 12:41:07 +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")) {
|
if (CONFIG.get("settings.enableGlobalHotkey")) {
|
||||||
try {
|
try {
|
||||||
const ret = globalShortcut.register(CONFIG.get("settings.globalHotkey"), () => {
|
const ret = globalShortcut.register(CONFIG.get("settings.globalHotkey"), () => {
|
||||||
|
if (!win) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (win.isFocused()) {
|
||||||
|
app.hide()
|
||||||
|
} else {
|
||||||
app.focus({steal: true})
|
app.focus({steal: true})
|
||||||
if (win?.isMinimized()) {
|
if (win.isMinimized()) {
|
||||||
win?.restore()
|
win.restore()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user