Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Feat: **Ghostty switches to the right tab when several sessions share a directory** ([#63](https://github.com/grimmerk/codev/issues/63)). Ghostty's tip builds expose each terminal's `tty` (ghostty-org/ghostty#11922), so switching now works the way it does in iTerm2 and Terminal.app: by tty and by `/rename` title, in the order the session's process provenance calls for, and only then by working directory. Before, a session without a custom title went to the first tab in its directory — measured on one machine with 16 sessions sharing `~/git`, every one of them landed on the same tab. Detection's fallback cross-reference uses the tty the same way. **Stable Ghostty (1.3.1 and earlier) has no `tty`**, so there CodeV behaves exactly as before — title, then directory — until a release ships it
- Fix: detection's fallback cross-reference no longer gives a running process to the wrong session when one `/rename` title contains another (`Fix` inside `Fix backend`). Every terminal (iTerm2, cmux, Terminal.app, Ghostty) took the first title its tab matched, from every transcript in the directory; it now takes the longest match among the sessions actually queued for that process. One function for all four, where there used to be four copies
- Fix: **closing Settings puts the cursor back in the search box.** Opening Settings moves focus into its panel, as before; but closing it with the same button left focus on that button, so typing searched nothing until you clicked a row or switched apps and back. The Settings button counts as part of the panel, which the switcher deliberately never steals focus from, so its click-to-refocus skipped it. Closing the panel now hands focus back to the current tab's search box

## 1.0.93

Expand Down
17 changes: 17 additions & 0 deletions src/popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,15 @@ const PopupDefaultExample = ({
switcherMode,
openToTab,
onOpenToTabConsumed,
onClosed,
}: {
workingFolderPath?: string;
saveCallback?: (key: string, value: string) => void;
openCallback?: any;
switcherMode?: string;
openToTab?: 'general' | 'sessions' | 'accounts' | 'shortcuts' | null;
onOpenToTabConsumed?: () => void;
onClosed?: () => void;
}) => {
const [isOpen, setIsOpen] = useState(false);
const [launchAtLogin, setLaunchAtLogin] = useState(false);
Expand Down Expand Up @@ -505,6 +507,21 @@ const PopupDefaultExample = ({
}
}, [openToTab]);

// Hand focus back to the parent when the panel closes. While open, the
// Popup's focus trap holds focus inside the panel; the Settings button that
// closes it keeps focus afterwards, and the switcher's click-to-refocus
// skips it (it is part of the panel), so typing went nowhere until the user
// clicked elsewhere. The timeout runs after any focus the trap returns on
// deactivate, which it also defers with a 0ms timeout.
const wasOpenRef = useRef(false);
useEffect(() => {
const wasOpen = wasOpenRef.current;
wasOpenRef.current = isOpen;
if (!wasOpen || isOpen || !onClosed) return;
const timer = setTimeout(onClosed, 0);
return () => clearTimeout(timer);
}, [isOpen]);

const handleLaunchAtLoginChange = (checked: boolean) => {
setLaunchAtLogin(checked);
window.electronAPI.setLoginItemSettings(checked);
Expand Down
1 change: 1 addition & 0 deletions src/switcher-ui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2635,6 +2635,7 @@ function SwitcherApp() {
switcherMode={mode}
openToTab={settingsOpenToTab}
onOpenToTabConsumed={() => setSettingsOpenToTab(null)}
onClosed={forceFocusOnInput}
saveCallback={(key: string, value: string) => {
if (key === 'sessionDisplayMode') {
setSessionDisplayMode(value);
Expand Down
Loading