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:
@@ -157,12 +157,7 @@ return false`
|
||||
const focused = out.trim() === "true"
|
||||
|
||||
if (focused) {
|
||||
const ttys = getSessionTtys(projectPath)
|
||||
for (const tty of ttys) {
|
||||
try {
|
||||
await Bun.write(tty, "\x07")
|
||||
} catch {}
|
||||
}
|
||||
flashTerminalByTty(tty)
|
||||
}
|
||||
|
||||
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 {
|
||||
let changed = false
|
||||
for (const project of projects) {
|
||||
|
||||
@@ -125,15 +125,15 @@ function fmtProjectRow(project: Project, isSelected: boolean) {
|
||||
if (project.activeSessions > 0) {
|
||||
if (project.busySessions > 0) {
|
||||
activeDot = green("●")
|
||||
activeTag = project.activeSessions > 1 ? yellow(String(project.activeSessions)) : " "
|
||||
activeTag = project.activeSessions > 1 ? yellow(String(project.activeSessions).padEnd(2)) : " "
|
||||
} else {
|
||||
activeDot = yellow("◉")
|
||||
const elapsed = elapsedCompact(project.lastActivityMs)
|
||||
activeTag = elapsed ? dim(elapsed.padEnd(2).slice(0, 2)) : " "
|
||||
activeTag = elapsed ? dim(elapsed.padEnd(2).slice(0, 2)) : " "
|
||||
}
|
||||
} else {
|
||||
activeDot = dim("○")
|
||||
activeTag = " "
|
||||
activeTag = " "
|
||||
}
|
||||
const check = isSelected ? green("✓") : " "
|
||||
const arrow = project.expanded ? "▼" : "▶"
|
||||
|
||||
Reference in New Issue
Block a user