mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +08:00
fix: shortcut window display issue
This commit is contained in:
parent
96ef2d2bbc
commit
d8fdbebc4b
@ -433,15 +433,19 @@ export async function createWindow(): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function triggerMainWindow(): void {
|
export function triggerMainWindow(force?: boolean): void {
|
||||||
if (mainWindow) {
|
if (mainWindow) {
|
||||||
getAppConfig()
|
getAppConfig()
|
||||||
.then(({ triggerMainWindowBehavior = 'show' }) => {
|
.then(({ triggerMainWindowBehavior = 'toggle' }) => {
|
||||||
if (triggerMainWindowBehavior === 'toggle' && mainWindow?.isVisible()) {
|
if (force === true || triggerMainWindowBehavior === 'toggle') {
|
||||||
|
if (mainWindow?.isVisible()) {
|
||||||
closeMainWindow()
|
closeMainWindow()
|
||||||
} else {
|
} else {
|
||||||
showMainWindow()
|
showMainWindow()
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
showMainWindow()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(showMainWindow)
|
.catch(showMainWindow)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export async function registerShortcut(
|
|||||||
switch (action) {
|
switch (action) {
|
||||||
case 'showWindowShortcut': {
|
case 'showWindowShortcut': {
|
||||||
return globalShortcut.register(newShortcut, () => {
|
return globalShortcut.register(newShortcut, () => {
|
||||||
triggerMainWindow()
|
triggerMainWindow(true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
case 'showFloatingWindowShortcut': {
|
case 'showFloatingWindowShortcut': {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user