optimize: 优化快捷键显示/隐藏窗口功能:当窗口打开着但未获取焦点时,快捷键可获取窗口焦点,而不是隐藏窗口。

pull/361/head
王良 2024-09-20 13:59:09 +08:00
parent 56afeebf05
commit e94056941a
1 changed files with 7 additions and 2 deletions

View File

@ -285,8 +285,13 @@ function initApp () {
globalShortcut.unregisterAll()
if (DevSidecar.api.config.get().app.showHideShortcut) {
globalShortcut.register(DevSidecar.api.config.get().app.showHideShortcut, () => {
if (winIsHidden) {
showWin()
if (winIsHidden || !win.isFocused()) {
if (!win.isFocused()) {
win.focus()
}
if (winIsHidden) {
showWin()
}
} else {
// linux快捷键不关闭窗口
if (!isLinux()) {