Skip to content

fix(tmux): restore dual status bar with clickable tabs and agent enrichment - #652

Merged
namastex888 merged 1 commit into
devfrom
fix-tmux-statusbar
Mar 18, 2026
Merged

namastex888 merged 1 commit into
devfrom
fix-tmux-statusbar

Conversation

@namastex888

Copy link
Copy Markdown
Contributor

Summary

Fixes two bugs from PR #646 (tmux-split-tabbar) that made the dual status bar completely non-functional:

  • Fixed awk $1/$2 shell 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
  • Made bottom bar window tabs clickable — replaced #() shell script with #{W} token in status-format[1], which uses native tmux window-status-format templates with mouse support
  • Added agent enrichment to window tabs — window-status-format and window-status-current-format now show ×count emoji (e.g., ×3 🔨) per window via new genie-window-label.sh script
  • Added overflow handling for projects bar — truncates at 8 sessions with +N more indicator, active session always visible

Files Changed

File Change
scripts/tmux/genie.tmux.conf Fix version guard awk escaping, use #{W} in status-format[1], enrich window-status-format
scripts/tmux/genie-window-label.sh NEW — per-window agent count + state emoji (<50ms, jq-based)
scripts/tmux/genie-projects.sh Add overflow handling for >8 sessions

Test plan

  • Verify dual bar (2 lines) activates on tmux >= 3.2
  • Verify single bar fallback on tmux < 3.2
  • Click window tabs in bottom bar — should switch windows
  • Verify agent count/emoji display per window
  • Run tmux source ~/.tmux.conf — no errors
  • Test with >8 sessions — overflow shows +N more

Wish: fix-tmux-dual-statusbar

…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.
@coderabbitai

coderabbitai Bot commented Mar 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1eb8ffc6-08f1-4f20-8627-145424c5de90

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-tmux-statusbar
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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

  • Dual Status Bar Fix: Corrected an issue in the version guard that prevented the dual status bar from activating correctly on tmux versions >= 3.2.
  • Clickable Window Tabs: Implemented clickable window tabs in the bottom bar by replacing a shell script with the native tmux #{W} token, enabling mouse support.
  • Agent Enrichment: Added agent enrichment to window tabs, displaying agent count and state emoji per window using a new genie-window-label.sh script.
  • Overflow Handling: Implemented overflow handling for the projects bar, truncating the display at 8 sessions with a '+N more' indicator, while ensuring the active session is always visible.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@namastex888
namastex888 merged commit 931ea45 into dev Mar 18, 2026
6 checks passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +90 to +130
# 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 "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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]"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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=""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The active_output variable is initialized on this line and then set within the if [[ "$has_tmux" == "true" ]] block (lines 59-60), but it is never actually used in the subsequent logic that constructs the final output string. This variable appears to be dead code and can be removed.

Comment on lines +76 to +80
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}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The logic for calculating task_count (lines 76-80 and 103-107) is duplicated in both the no-overflow and overflow branches. Consider extracting this into a helper function or a single calculation point to improve maintainability and reduce redundancy.

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} "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The genie-tasks.sh script was previously used for status-format[1] but has been replaced by #{W}. If genie-tasks.sh is no longer used anywhere else in the configuration or by other scripts, it should be removed from the repository to avoid maintaining dead code.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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}) "

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@namastex888
namastex888 deleted the fix-tmux-statusbar branch March 29, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant