Skip to content
This repository has been archived by the owner on Oct 19, 2022. It is now read-only.

Commit

Permalink
Shortcuts fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Sep 17, 2022
1 parent fb019fc commit fd8a4d8
Showing 1 changed file with 30 additions and 24 deletions.
54 changes: 30 additions & 24 deletions interface/libraries/shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,35 +129,41 @@ export const editShortcut = (id: number) => {
export const registerShortcuts = () => {
globalShortcut.unregisterAll()

globalShortcut.register(settings.shortcuts.show, async () => {
await invoke("update_tray")

const windowShown = await window.appWindow.isVisible()
if (settings.shortcuts.show !== "None") {
globalShortcut.register(settings.shortcuts.show, async () => {
await invoke("update_tray")

const windowShown = await window.appWindow.isVisible()

if (windowShown === true) {
window.appWindow.hide()
} else {
await window.appWindow.show()
await window.appWindow.unminimize()
await window.appWindow.setFocus()
}
})
}

if (windowShown === true) {
window.appWindow.hide()
} else {
await window.appWindow.show()
await window.appWindow.unminimize()
await window.appWindow.setFocus()
}
})
if (settings.shortcuts.settings !== "None") {
globalShortcut.register(settings.shortcuts.settings, async () => {
const windowShown = await window.appWindow.isVisible()

globalShortcut.register(settings.shortcuts.settings, async () => {
const windowShown = await window.appWindow.isVisible()
if (windowShown === true) {
navigate("settings")
} else {
window.appWindow.show()
}

if (windowShown === true) {
navigate("settings")
} else {
window.appWindow.show()
}

navigate("settings")
})
})
}

globalShortcut.register(settings.shortcuts.exit, async () => {
exit()
})
if (settings.shortcuts.exit) {
globalShortcut.register(settings.shortcuts.exit, async () => {
exit()
})
}
}

registerShortcuts()

0 comments on commit fd8a4d8

Please sign in to comment.