feat: flash terminal background on focus and fix active tag alignment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-02-24 12:52:10 +00:00
parent bd3df2be9c
commit f8c6a5f584
2 changed files with 28 additions and 9 deletions

View File

@@ -157,12 +157,7 @@ return false`
const focused = out.trim() === "true" const focused = out.trim() === "true"
if (focused) { if (focused) {
const ttys = getSessionTtys(projectPath) flashTerminalByTty(tty)
for (const tty of ttys) {
try {
await Bun.write(tty, "\x07")
} catch {}
}
} }
return focused return focused
@@ -171,6 +166,30 @@ return false`
} }
} }
function flashTerminalByTty(tty: string): void {
const script = `
tell application "Terminal"
repeat with w in windows
repeat with t in tabs of w
if tty of t is "${tty}" then
set origBg to background color of t
repeat 3 times
set background color of t to {12000, 12000, 28000}
delay 0.12
set background color of t to origBg
delay 0.12
end repeat
return
end if
end repeat
end repeat
end tell`
Bun.spawn(["osascript", "-e", script], {
stdout: "ignore",
stderr: "ignore",
})
}
export function updateProjectSessions(projects: Project[], sessions: Map<string, number>): boolean { export function updateProjectSessions(projects: Project[], sessions: Map<string, number>): boolean {
let changed = false let changed = false
for (const project of projects) { for (const project of projects) {

View File

@@ -125,15 +125,15 @@ function fmtProjectRow(project: Project, isSelected: boolean) {
if (project.activeSessions > 0) { if (project.activeSessions > 0) {
if (project.busySessions > 0) { if (project.busySessions > 0) {
activeDot = green("●") activeDot = green("●")
activeTag = project.activeSessions > 1 ? yellow(String(project.activeSessions)) : " " activeTag = project.activeSessions > 1 ? yellow(String(project.activeSessions).padEnd(2)) : " "
} else { } else {
activeDot = yellow("◉") activeDot = yellow("◉")
const elapsed = elapsedCompact(project.lastActivityMs) const elapsed = elapsedCompact(project.lastActivityMs)
activeTag = elapsed ? dim(elapsed.padEnd(2).slice(0, 2)) : " " activeTag = elapsed ? dim(elapsed.padEnd(2).slice(0, 2)) : " "
} }
} else { } else {
activeDot = dim("○") activeDot = dim("○")
activeTag = " " activeTag = " "
} }
const check = isSelected ? green("✓") : " " const check = isSelected ? green("✓") : " "
const arrow = project.expanded ? "▼" : "▶" const arrow = project.expanded ? "▼" : "▶"