diff --git a/.claude/hooks/claude-popup.py b/.claude/hooks/beacon.py similarity index 97% rename from .claude/hooks/claude-popup.py rename to .claude/hooks/beacon.py index a0a3758..6c83cea 100755 --- a/.claude/hooks/claude-popup.py +++ b/.claude/hooks/beacon.py @@ -1,10 +1,10 @@ #!/usr/bin/env python3 """ -Claude Code — unified popup for all hooks. +Beacon — Claude Code desktop overlay for session stops and tool confirms. Usage: - claude-popup.py stop [session_file] - claude-popup.py confirm + beacon.py stop [session_file] + beacon.py confirm """ import sys, os, json @@ -135,13 +135,6 @@ QWidget#summary_card {{ border-radius: 10px; border: 1px solid {border}; }} -QLabel#sum_key {{ - color: {text3}; - font-size: 10px; - font-weight: 700; - letter-spacing: 1.2px; - text-transform: uppercase; -}} QLabel#sum_val {{ color: {text1}; font-size: 16px; @@ -587,14 +580,14 @@ class ContinuePopup(BasePopup): div.setStyleSheet(f"background:{C['border']};max-height:1px;min-height:1px;") box_lay.addWidget(div) - # ── Narrative rows ── + # ── Narrative rows — UP NEXT first (actionable), DONE last (context) ── PREVIEW = 200 narrative = [ - (C['green'], "DONE", 'done'), - (C['amber'], "IN PROGRESS", 'in_progress'), - (C['cyan'], "UP NEXT", 'next'), + (C['cyan'], "UP NEXT", 'next', True), + (C['amber'], "IN PROGRESS", 'in_progress', True), + (C['green'], "DONE", 'done', False), ] - has_narrative = any(k in parsed for _, _, k in narrative) + has_narrative = any(k in parsed for _, _, k, _ in narrative) if not has_narrative and not meta_keys: v = QLabel(self.session) v.setObjectName("sum_val") @@ -602,7 +595,7 @@ class ContinuePopup(BasePopup): v.setMaximumWidth(480) box_lay.addWidget(v) - for color, label, key in narrative: + for color, label, key, prominent in narrative: if key not in parsed: continue val_text = parsed[key] @@ -618,14 +611,18 @@ class ContinuePopup(BasePopup): v_lbl = QLabel(val_text[:PREVIEW] + ("…" if is_long else "")) v_lbl.setObjectName("sum_val") v_lbl.setWordWrap(True) - v_lbl.setMaximumWidth(400) + v_lbl.setMaximumWidth(480) + if not prominent: + v_lbl.setStyleSheet(f"color:{C['text2']};font-size:14px;line-height:1.5;") row.addWidget(v_lbl) if is_long: full = QLabel(val_text) full.setObjectName("sum_more") full.setWordWrap(True) - full.setMaximumWidth(400) + full.setMaximumWidth(480) + if not prominent: + full.setStyleSheet(f"color:{C['text2']};font-size:14px;line-height:1.5;") full.setVisible(False) tog = SafeButton("▸ show more") tog.setObjectName("expand") @@ -1109,6 +1106,7 @@ def main(): sys.exit(1) os.environ.setdefault("DISPLAY", ":0") app = QApplication(sys.argv) + app.setApplicationName("Beacon") mode = sys.argv[1] if mode == "confirm": diff --git a/.claude/hooks/pre-tool-use.sh b/.claude/hooks/pre-tool-use.sh index a51cd81..832e2e0 100755 --- a/.claude/hooks/pre-tool-use.sh +++ b/.claude/hooks/pre-tool-use.sh @@ -33,7 +33,7 @@ if [ "$TOOL_NAME" = "Bash" ]; then echo "$COMMAND" > "$TMPFILE" CHOICE=$(DISPLAY="${DISPLAY:-:1}" DBUS_SESSION_BUS_ADDRESS="$_DBUS" \ - python3 ~/.claude/hooks/claude-popup.py confirm "Bash" "$TMPFILE" 2>/dev/null) + python3 ~/.claude/hooks/beacon.py confirm "Bash" "$TMPFILE" 2>/dev/null) rm -f "$TMPFILE" [ "$CHOICE" = "allow" ] && echo "$ALLOW" || echo "$DENY" diff --git a/.claude/hooks/stop.sh b/.claude/hooks/stop.sh index 49f5313..0a81bab 100755 --- a/.claude/hooks/stop.sh +++ b/.claude/hooks/stop.sh @@ -51,17 +51,25 @@ curl -sf -X PATCH "http://localhost:3000/api/project-states/${TAB_NAME}" \ -H "Content-Type: application/json" \ -d "{\"tabName\":\"${TAB_NAME}\",\"readyAt\":\"$(date -Iseconds)\"}" &>/dev/null & +play_sound "complete" + +# If Cockpit is running, it handles auto-continue via the web UI — skip native popup. +# The web UI pauses when the user is typing; the native popup can't detect that and +# would race against Cockpit, injecting a prompt while the user is mid-sentence. +if curl -sf --max-time 1 "http://localhost:3000/api/control" >/dev/null 2>&1; then + log "Cockpit running — skipping native popup, Cockpit handles auto-continue for $LABEL" + exit 0 +fi + # Block notification.sh from auto-injecting while this popup is open LOCK="/tmp/claude-stop-active-${TAB_NAME}" touch "$LOCK" trap "rm -f '$LOCK'" EXIT -play_sound "complete" - SESSION_FILE="$HOME/.claude/sessions/${TAB_NAME}.md" CHOICE=$(DISPLAY="${DISPLAY:-:1}" DBUS_SESSION_BUS_ADDRESS="$_DBUS" \ - python3 ~/.claude/hooks/claude-popup.py stop "$LABEL" "$SESSION_FILE" 2>>"$LOG") + python3 ~/.claude/hooks/beacon.py stop "$LABEL" "$SESSION_FILE" 2>>"$LOG") log "popup choice=$CHOICE" [ -z "$CHOICE" ] && exit 0