fix(tmux): restore dual status bar with clickable tabs and agent enrichment - #652
Conversation
…chment
Fix broken awk $1/$2 escaping in version guard that prevented dual bar
from activating. Replace genie-tasks.sh script call in status-format[1]
with native #{W} token for clickable window tabs. Add per-window agent
enrichment via genie-window-label.sh called from window-status-format
templates. Add overflow handling to genie-projects.sh for >8 sessions.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses issues introduced in PR #646, specifically related to the tmux dual status bar. It restores the functionality of the dual status bar, makes window tabs clickable, enriches window tabs with agent information, and adds overflow handling for the projects bar, improving the user experience and information display within tmux. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request successfully addresses the reported issues, restoring the dual status bar functionality, making window tabs clickable, and enriching them with agent information. The new genie-window-label.sh script provides valuable per-window context. However, there are some areas for improvement in the genie-projects.sh script's overflow handling logic and a potential color visibility issue in genie.tmux.conf.
| # Overflow — show up to max_visible with active session always included | ||
| shown=0 | ||
| active_shown=false | ||
|
|
||
| for session_name in "${all_sessions[@]}"; do | ||
| if [[ "$shown" -ge "$((max_visible - 1))" && "$active_shown" == "false" && "$session_name" != "$active_session" ]]; then | ||
| # Reserve last slot for active session | ||
| continue | ||
| fi | ||
| if [[ "$shown" -ge "$max_visible" ]]; then | ||
| break | ||
| fi | ||
|
|
||
| task_count="${agent_counts[$session_name]:-0}" | ||
| if [[ "$has_tmux" == "true" ]]; then | ||
| wcount=$(tmux list-windows -t "$session_name" -F "x" 2>/dev/null | wc -l) || wcount=0 | ||
| task_count="${agent_counts[$session_name]:-$wcount}" | ||
| fi | ||
|
|
||
| if [[ "$session_name" == "$active_session" ]]; then | ||
| output+="#[bg=#7b2ff7,fg=#e0e0e0,bold] ${session_name} (${task_count}) ● #[bg=#1a1a2e,fg=#7b2ff7] " | ||
| active_shown=true | ||
| else | ||
| output+="#[fg=#b8a9c9,bg=#1a1a2e] ${session_name} (${task_count}) " | ||
| fi | ||
| ((shown++)) || true | ||
| done | ||
|
|
||
| # If active session wasn't shown yet, append it | ||
| if [[ "$active_shown" == "false" && -n "$active_session" ]]; then | ||
| task_count="${agent_counts[$active_session]:-0}" | ||
| if [[ "$has_tmux" == "true" ]]; then | ||
| wcount=$(tmux list-windows -t "$active_session" -F "x" 2>/dev/null | wc -l) || wcount=0 | ||
| task_count="${agent_counts[$active_session]:-$wcount}" | ||
| fi | ||
| output+="#[bg=#7b2ff7,fg=#e0e0e0,bold] ${active_session} (${task_count}) ● #[bg=#1a1a2e,fg=#7b2ff7] " | ||
| fi | ||
|
|
||
| # Append overflow indicator | ||
| remaining=$((total - max_visible)) | ||
| output+="#[fg=#6c6c8a,bg=#1a1a2e] +${remaining} more " |
There was a problem hiding this comment.
The logic for handling overflow (lines 90-130) attempts to ensure the active session is visible. However, if the active session is not among the first max_visible - 1 sessions, it is appended after the +N more indicator (lines 118-126). This means it might not be visually within the max_visible count, which could be confusing. The goal should be to always include the active session within the max_visible slots, potentially by replacing one of the non-active sessions if max_visible is reached.
| # Active tab: purple bg, white text, bold | ||
| set -g window-status-current-format "#[fg=#1a1a2e,bg=#7b2ff7]#[fg=#e0e0e0,bg=#7b2ff7,bold] #I:#W #[fg=#7b2ff7,bg=#1a1a2e]" | ||
| # Active tab: purple bg, white text, bold with agent enrichment | ||
| set -g window-status-current-format "#[fg=#16213e,bg=#7b2ff7]#[fg=#e0e0e0,bg=#7b2ff7,bold] #I:#W#($HOME/.genie/scripts/genie-window-label.sh #{session_name} #{window_name}) #[fg=#7b2ff7,bg=#16213e]" |
There was a problem hiding this comment.
In window-status-current-format, the foreground color #[fg=#16213e] is set to the surface background color. This might make the text difficult to read against the active tab's purple background (bg=#7b2ff7). It's generally better to use a contrasting color, such as #e0e0e0 (primary text), for readability.
#[fg=#e0e0e0,bg=#7b2ff7]#[fg=#e0e0e0,bg=#7b2ff7,bold] #I:#W#($HOME/.genie/scripts/genie-window-label.sh #{session_name} #{window_name}) #[fg=#7b2ff7,bg=#16213e]
| output="" | ||
| declare -A seen_sessions=() | ||
| declare -a all_sessions=() | ||
| active_output="" |
There was a problem hiding this comment.
| task_count="${agent_counts[$session_name]:-0}" | ||
| # Prefer window count from tmux if available | ||
| if [[ "$has_tmux" == "true" ]]; then | ||
| wcount=$(tmux list-windows -t "$session_name" -F "x" 2>/dev/null | wc -l) || wcount=0 | ||
| task_count="${agent_counts[$session_name]:-$wcount}" |
| set -g status-format[1] "#[align=left,bg=#16213e] #($HOME/.genie/scripts/genie-tasks.sh #{session_name}) " | ||
| # --- Bottom bar (status-format[1]): native clickable window tabs --- | ||
| # #{W} expands window-status-format / window-status-current-format with mouse support | ||
| set -g status-format[1] "#[align=left,bg=#16213e] #{W} " |
There was a problem hiding this comment.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e67fb3498
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| active_shown=false | ||
|
|
||
| for session_name in "${all_sessions[@]}"; do | ||
| if [[ "$shown" -ge "$((max_visible - 1))" && "$active_shown" == "false" && "$session_name" != "$active_session" ]]; then |
There was a problem hiding this comment.
Skip active-slot reservation when active session is unknown
The overflow branch always reserves one slot for the active session (shown >= max_visible - 1 while active_shown is false), but when active_session is empty (for example, running without an attached tmux client or in no-tmux test mode), that slot is never filled. In this case the loop renders only 7 sessions, then remaining is still computed as total - max_visible, so the +N more count is off by one and one extra session is silently hidden.
Useful? React with 👍 / 👎.
| # Inactive tabs: lavender text on dark bg | ||
| set -g window-status-format "#[fg=#b8a9c9,bg=#1a1a2e] #I:#W " | ||
| # Inactive tabs: lavender text on surface bg (matches bottom bar line bg) | ||
| set -g window-status-format "#[fg=#b8a9c9,bg=#16213e] #I:#W#($HOME/.genie/scripts/genie-window-label.sh #{session_name} #{window_name}) " |
There was a problem hiding this comment.
Shell-quote tmux format args in window label command
This #() command passes #{session_name} and #{window_name} to the shell without quoting/escaping. If a window is renamed with spaces or shell metacharacters, the shell will split or interpret the expanded value before genie-window-label.sh runs, which can break agent lookup for that tab and may execute unintended shell fragments during status refresh. Please use tmux shell-quoting (for example #{q:...}) for both arguments.
Useful? React with 👍 / 👎.
Summary
Fixes two bugs from PR #646 (tmux-split-tabbar) that made the dual status bar completely non-functional:
$1/$2shell expansion bug in the version guard (genie.tmux.conf:97) — the dual bar now correctly activates on tmux >= 3.2 and falls back to single bar on older versions#()shell script with#{W}token instatus-format[1], which uses native tmux window-status-format templates with mouse supportwindow-status-formatandwindow-status-current-formatnow show×count emoji(e.g.,×3 🔨) per window via newgenie-window-label.shscript+N moreindicator, active session always visibleFiles Changed
scripts/tmux/genie.tmux.conf#{W}in status-format[1], enrich window-status-formatscripts/tmux/genie-window-label.shscripts/tmux/genie-projects.shTest plan
tmux source ~/.tmux.conf— no errors+N moreWish: fix-tmux-dual-statusbar