小调整。

pull/448/head
王良 2025-02-10 19:58:35 +08:00
parent 19ffe01b57
commit f20d0a0757
1 changed files with 5 additions and 5 deletions

View File

@ -170,7 +170,7 @@ function checkHideWin () {
return true return true
} }
function hideWin (reason = '', needCheck = true) { function hideWin (reason = '', needCheck = false) {
if (win) { if (win) {
if (needCheck && !checkHideWin()) { if (needCheck && !checkHideWin()) {
return return
@ -255,7 +255,7 @@ function createWindow (startHideWindow, autoQuitIfError = true) {
} }
if (startHideWindow) { if (startHideWindow) {
hideWin('startHideWindow', false) hideWin('startHideWindow')
} }
win.on('closed', async (...args) => { win.on('closed', async (...args) => {
@ -268,7 +268,7 @@ function createWindow (startHideWindow, autoQuitIfError = true) {
if (message.value === 1) { if (message.value === 1) {
quit('ipc receive "close"') quit('ipc receive "close"')
} else { } else {
hideWin('ipc receive "close"') hideWin('ipc receive "close"', true)
} }
}) })
@ -285,7 +285,7 @@ function createWindow (startHideWindow, autoQuitIfError = true) {
quit('win close') quit('win close')
} else if (closeStrategy === 2) { } else if (closeStrategy === 2) {
// 隐藏窗口 // 隐藏窗口
hideWin('win close') hideWin('win close', true)
} else { } else {
// 弹窗提示,选择关闭策略 // 弹窗提示,选择关闭策略
win.webContents.send('close.showTip', { closeStrategy, showHideShortcut: config.app.showHideShortcut }) win.webContents.send('close.showTip', { closeStrategy, showHideShortcut: config.app.showHideShortcut })
@ -381,7 +381,7 @@ function registerShowHideShortcut (showHideShortcut) {
if (!win.isFocused()) { if (!win.isFocused()) {
win.focus() // 如果窗口打开着但没有获取焦点则获取焦点而不是hide win.focus() // 如果窗口打开着但没有获取焦点则获取焦点而不是hide
} else { } else {
hideWin('shortcut', false) // 快捷键隐藏窗口,不需要提示 hideWin('shortcut')
} }
} }
}) })