diff --git a/CHANGELOG.md b/CHANGELOG.md index 8395276..74a86c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.0.72 + +- Fix: window-toggle actions bring window to front when covered by another app (Normal mode) + - `Cmd+Ctrl+R` (Quick Switcher), `Cmd+Ctrl+T` (Terminal), and tray left-click + - Previously: visible-but-unfocused first press hid the window + - Now: visible+unfocused → focus to top; visible+focused → hide (or toggle Terminal tab) + - Menu bar mode unaffected (`onBlur` auto-hide makes the state unreachable) + ## 1.0.71 - Fix: use `setActivationPolicy` instead of `app.dock.hide/show` for proper Dock behavior diff --git a/package.json b/package.json index 285f32f..038014a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "CodeV", "productName": "CodeV", - "version": "1.0.71", + "version": "1.0.72", "description": "Quick switcher for VS Code, Cursor, and Claude Code sessions", "repository": { "type": "git", diff --git a/src/main.ts b/src/main.ts index c6f91b2..f18a8e5 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1002,12 +1002,24 @@ const trayToggleEvtHandler = async () => { showSwitcherWindow(); } else { const window = getSwitcherWindow(); - - if (window && window.isVisible()) { - if (isDebug) { - console.log('is visible, to hide'); + + if (window && window.isVisible() && !window.isMinimized()) { + if (window.isFocused()) { + if (isDebug) { + console.log('is visible and focused, to hide'); + } + hideSwitcherWindow(); + } else { + // Visible but covered by another app — bring to front instead of hiding + if (isDebug) { + console.log('is visible but unfocused, bringing to front'); + } + if (appMode === 'normal') { + app.focus({ steal: true }); + } + window.show(); + window.focus(); } - hideSwitcherWindow(); } else if (window) { if (isDebug) { console.log('is not visible, to show'); @@ -1327,10 +1339,22 @@ const trayToggleEvtHandler = async () => { const window = getSwitcherWindow(); if (window && window.isVisible() && !window.isMinimized()) { - if (isDebug) { - console.log('Switcher window visible, hiding it'); + if (window.isFocused()) { + if (isDebug) { + console.log('Switcher window visible and focused, hiding it'); + } + hideSwitcherWindow(); + } else { + // Visible but covered by another app — bring to top instead of hiding + if (isDebug) { + console.log('Switcher window visible but unfocused, bringing to front'); + } + if (appMode === 'normal') { + app.focus({ steal: true }); + } + window.show(); + window.focus(); } - hideSwitcherWindow(); } else if (window) { if (isDebug) { console.log('Switcher window exists but hidden, showing it'); @@ -1626,9 +1650,19 @@ const trayToggleEvtHandler = async () => { switcherWindow = createSwitcherWindow(); } const window = getSwitcherWindow(); - if (window && window.isVisible()) { - // If already showing Terminal tab, hide; otherwise switch to Terminal - window.webContents.send('check-terminal-and-hide'); + if (window && window.isVisible() && !window.isMinimized()) { + if (window.isFocused()) { + // If already showing Terminal tab, hide; otherwise switch to Terminal + window.webContents.send('check-terminal-and-hide'); + } else { + // Visible but covered — bring to front and switch to Terminal tab + if (appMode === 'normal') { + app.focus({ steal: true }); + } + window.show(); + window.focus(); + window.webContents.send('switch-to-terminal'); + } } else if (window) { window.webContents.send('switch-to-terminal'); showSwitcherWindow();