mirror of
https://github.com/bitbaum/dotfiles.git
synced 2026-12-03 19:46:58 +01:00
feat(beacon): rename claude-popup.py → beacon.py + UX improvements
- Rename the popup to "Beacon" — its conversational name going forward
- UP NEXT now renders first (actionable context before historical)
- DONE section dimmed (14px, text2) — context, not action
- narrative label max-width raised to 480px for full 540px card
- Remove unused sum_key CSS rule
- Set app.setApplicationName("Beacon")
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
36669811b4
commit
8fa7ea76f5
3 files changed
+28
-22
No files matched your search
@@ -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 <project_label> [session_file]
|
||||
claude-popup.py confirm <tool_name> <cmd_file>
|
||||
beacon.py stop <project_label> [session_file]
|
||||
beacon.py confirm <tool_name> <cmd_file>
|
||||
"""
|
||||
|
||||
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":
|
||||
@@ -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"
|
||||
|
||||
+11
-3
@@ -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
|
||||
|
||||
Reference in new issue
Block a user