tmux: add pressure-based activity tracker

Add heartbeat.sh that tracks session active time using three native
tmux signals: client input (+5), window output (+2), and copy mode
(+2), with -1 decay per tick. Score drives a block bar indicator
and accumulated active time counter. Resets on tmux server restart.

Status bar updates:
- Heartbeat pill with pressure bar right of clock
- Responsive breakpoints: hide network/battery <120 cols, date <80
- Click clock/date to toggle condensed view
- Click heartbeat to instant-lock session
- Static colon in clock (replaces shell-based blinker)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-27 17:14:30 +00:00
parent e686b6396d
commit ffcaf71f82
2 changed files with 120 additions and 1 deletions

View File

@@ -24,6 +24,11 @@ set -g display-time 4000
# Mouse
set -g mouse on
set -g set-clipboard on
set -g @condensed 0
bind -T root MouseDown1StatusRight if-shell \
"[ $(( #{mouse_x} )) -ge $(( #{client_width} - 9 )) ]" \
"lock-session" \
'if-shell "[ \"$(tmux show-option -gqv @condensed)\" = 1 ]" "set -g @condensed 0" "set -g @condensed 1"'
# Copy mode
setw -g mode-keys vi
@@ -66,7 +71,7 @@ set -g status-position bottom
set -g status-interval 1
set -g status-style "fg=#7290B8,bg=default"
set -g status-left "#{?client_prefix,#[fg=colour208]● ,#[fg=#3C3C3C]● }"
set -g status-right "#(~/.tmux/network.sh) #[fg=#3C3C3C] #(~/.tmux/battery.sh) #[fg=#3C3C3C] #[fg=#808080]%a %d %b #[fg=#2CB494,bg=#1A1A1A] %H:%M #[default] "
set -g status-right "#{?@condensed,,#{?#{e|>=|:#{client_width},120},#(~/.tmux/network.sh) #[fg=#3C3C3C] #(~/.tmux/battery.sh) #[fg=#3C3C3C] ,}}#{?@condensed,,#{?#{e|>=|:#{client_width},80},#[fg=#808080]%a %d %b ,}}#{?@condensed,#[fg=#3C3C3C],}#[fg=#2CB494]#[bg=#1A1A1A] %H:%M #[default]#(~/.tmux/heartbeat.sh)"
set -g status-right-length 80
set -g window-status-format "#{?window_last_flag, #[fg=#1A7A64]#I#[fg=default] #W , #I #W }"
set -g window-status-current-format " #[fg=#085040]#I#[fg=#0A0A0A] #W "