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