From f8c6a5f5840fb9c38626214fce078263c03b264a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Guti=C3=A9rrez?= <35082514+alezmad@users.noreply.github.com> Date: Tue, 24 Feb 2026 12:52:10 +0000 Subject: [PATCH] feat: flash terminal background on focus and fix active tag alignment Co-Authored-By: Claude Opus 4.6 --- src/data/monitor.ts | 31 +++++++++++++++++++++++++------ src/index.ts | 6 +++--- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/data/monitor.ts b/src/data/monitor.ts index 6039253..01b908a 100644 --- a/src/data/monitor.ts +++ b/src/data/monitor.ts @@ -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): boolean { let changed = false for (const project of projects) { diff --git a/src/index.ts b/src/index.ts index 4e5a0c3..b26fdf7 100755 --- a/src/index.ts +++ b/src/index.ts @@ -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 ? "▼" : "▶"