diff --git a/.tmux.conf b/.tmux.conf index 4f31bb5..746573d 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -48,6 +48,7 @@ set-hook -ag client-attached 'run -b "tmux refresh-client -S"' set-hook -gu pane-focus-in set-hook -g pane-focus-in "run -b 'bash ~/.config/tmux/fzf_panes.tmux update_mru_pane_ids'" set-hook -ag pane-focus-in 'run -b "test -x ~/.config/agent-tracker/bin/tracker-client && ~/.config/agent-tracker/bin/tracker-client command acknowledge --client #{client_tty} --session-id #{session_id} --window-id #{window_id} --pane #{pane_id} || true"' +set-hook -ag pane-focus-in 'run -b "tmux set -wu -t #{window_id} @unread 2>/dev/null || true"' set-hook -ag pane-focus-in 'run -b "tmux refresh-client -S"' set-hook -gu pane-died @@ -185,6 +186,7 @@ bind -n M-i select-pane -R bind > swap-pane -D bind < swap-pane -U bind | swap-pane +bind -n M-b run-shell 'val=$(tmux show -wv @unread 2>/dev/null); if [ "$val" = "1" ]; then tmux set -wu @unread; else tmux set -w @unread 1; fi; tmux refresh-client -S' bind -n M-m run-shell "test -f ~/.config/agent-tracker/scripts/focus_latest_notified.sh && bash ~/.config/agent-tracker/scripts/focus_latest_notified.sh || true" bind -n M-M run-shell "test -f ~/.config/agent-tracker/scripts/focus_last_origin.sh && bash ~/.config/agent-tracker/scripts/focus_last_origin.sh || true" bind Space run-shell "~/.config/tmux/scripts/toggle_orientation.sh" diff --git a/tmux/tmux-status/left.sh b/tmux/tmux-status/left.sh index c7f4bbe..43e8cac 100755 --- a/tmux/tmux-status/left.sh +++ b/tmux/tmux-status/left.sh @@ -69,6 +69,15 @@ fi get_session_icon() { local sid="$1" + + # Check for manual @unread on any window in this session + local unread_win + unread_win=$(tmux list-windows -t "$sid" -F '#{@unread}' 2>/dev/null | grep -m1 '^1$' || true) + if [[ -n "$unread_win" ]]; then + printf '🔔' + return + fi + [[ -z "$tracker_state" ]] && return local result result=$(echo "$tracker_state" | jq -r --arg sid "$sid" ' diff --git a/tmux/tmux-status/window_task_icon.sh b/tmux/tmux-status/window_task_icon.sh index 2af877e..b0034f3 100755 --- a/tmux/tmux-status/window_task_icon.sh +++ b/tmux/tmux-status/window_task_icon.sh @@ -4,6 +4,13 @@ set -euo pipefail window_id="$1" [[ -z "$window_id" ]] && exit 0 +# Check manual @unread flag +unread=$(tmux show -wv -t "$window_id" @unread 2>/dev/null || true) +if [[ "$unread" == "1" ]]; then + printf '🔔' + exit 0 +fi + CACHE_FILE="/tmp/tmux-tracker-cache.json" [[ ! -f "$CACHE_FILE" ]] && exit 0