Skip to content

Commit 5933a0a

Browse files
grimmerkclaude
andcommitted
fix: extend focus-when-covered fix to tray click + Cmd+Ctrl+T
Apply the same three-state logic to: - Tray left-click (trayToggleEvtHandler default branch) - Cmd+Ctrl+T Terminal callback For Cmd+Ctrl+T, the visible-but-unfocused branch also sends 'switch-to-terminal' so the user lands on the Terminal tab after the window comes to front (matches the user intent of "I want to use the terminal"). Also adds the missing !window.isMinimized() check to both callbacks for consistency with quickSwitcherCallback. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6d36860 commit 5933a0a

2 files changed

Lines changed: 34 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
## 1.0.72
44

5-
- Fix: `Cmd+Ctrl+R` brings window to front when covered by another app
5+
- Fix: window-toggle actions bring window to front when covered by another app (Normal mode)
6+
- `Cmd+Ctrl+R` (Quick Switcher), `Cmd+Ctrl+T` (Terminal), and tray left-click
67
- Previously: visible-but-unfocused first press hid the window
7-
- Now: visible+unfocused → focus to top; visible+focused → hide
8+
- Now: visible+unfocused → focus to top; visible+focused → hide (or toggle Terminal tab)
9+
- Menu bar mode unaffected (`onBlur` auto-hide makes the state unreachable)
810

911
## 1.0.71
1012

src/main.ts

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,12 +1002,24 @@ const trayToggleEvtHandler = async () => {
10021002
showSwitcherWindow();
10031003
} else {
10041004
const window = getSwitcherWindow();
1005-
1006-
if (window && window.isVisible()) {
1007-
if (isDebug) {
1008-
console.log('is visible, to hide');
1005+
1006+
if (window && window.isVisible() && !window.isMinimized()) {
1007+
if (window.isFocused()) {
1008+
if (isDebug) {
1009+
console.log('is visible and focused, to hide');
1010+
}
1011+
hideSwitcherWindow();
1012+
} else {
1013+
// Visible but covered by another app — bring to front instead of hiding
1014+
if (isDebug) {
1015+
console.log('is visible but unfocused, bringing to front');
1016+
}
1017+
if (appMode === 'normal') {
1018+
app.focus({ steal: true });
1019+
}
1020+
window.show();
1021+
window.focus();
10091022
}
1010-
hideSwitcherWindow();
10111023
} else if (window) {
10121024
if (isDebug) {
10131025
console.log('is not visible, to show');
@@ -1638,9 +1650,19 @@ const trayToggleEvtHandler = async () => {
16381650
switcherWindow = createSwitcherWindow();
16391651
}
16401652
const window = getSwitcherWindow();
1641-
if (window && window.isVisible()) {
1642-
// If already showing Terminal tab, hide; otherwise switch to Terminal
1643-
window.webContents.send('check-terminal-and-hide');
1653+
if (window && window.isVisible() && !window.isMinimized()) {
1654+
if (window.isFocused()) {
1655+
// If already showing Terminal tab, hide; otherwise switch to Terminal
1656+
window.webContents.send('check-terminal-and-hide');
1657+
} else {
1658+
// Visible but covered — bring to front and switch to Terminal tab
1659+
if (appMode === 'normal') {
1660+
app.focus({ steal: true });
1661+
}
1662+
window.show();
1663+
window.focus();
1664+
window.webContents.send('switch-to-terminal');
1665+
}
16441666
} else if (window) {
16451667
window.webContents.send('switch-to-terminal');
16461668
showSwitcherWindow();

0 commit comments

Comments
 (0)