Skip to content

feat: port dual-line status bar support feature from tmux-powerline stale#75

Open
nuffin wants to merge 3 commits into
wfxr:masterfrom
nuffin:feat/dual-status-lines
Open

feat: port dual-line status bar support feature from tmux-powerline stale#75
nuffin wants to merge 3 commits into
wfxr:masterfrom
nuffin:feat/dual-status-lines

Conversation

@nuffin

@nuffin nuffin commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Description

Updated with upstream, and use functions to config the dual status bars.

I always open two many windows with long titles to, so only one line is not enough.

After a year, I refactor the code to make it more readable and editable. Tested on 2 boxes, work fine.

image

Checklist

  • Description above explains the change and motivation
  • Tested with at least one theme (gold, everforest, etc.)

Summary by CodeRabbit

  • New Features
    • Added dual status bar layout support alongside the existing single status bar mode
    • Introduced a status_lines setting to switch between single (1) and dual (2) status bar configurations
    • Keeps the default as single status bar mode for backward compatibility

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 78669617-7cc8-4927-bd60-4a5cb4df9d52

📥 Commits

Reviewing files that changed from the base of the PR and between f165ee9 and cc2f1e4.

📒 Files selected for processing (1)
  • tmux-power.tmux
🚧 Files skipped from review as they are similar to previous changes (1)
  • tmux-power.tmux

📝 Walkthrough

Walkthrough

A new status_lines setting (defaulting to "1") is added to set_defaults(). main() now branches on this value: the "1" path preserves the existing single-bar behavior, while any other value calls a new configure_dual_status_bars() function that sets status to 2 and configures status-format[0] and status-format[1] via build_status_format_0() and build_status_format_1().

Changes

Dual Status Bar Feature

Layer / File(s) Summary
Default setting and main() dispatch
tmux-power.tmux
set_defaults() adds status_lines='1' and main() branches on that value to call either the existing build_left_status/build_right_status or the new configure_dual_status_bars().
Dual status bar implementation
tmux-power.tmux
configure_dual_status_bars() sets status to 2; build_status_format_0() and build_status_format_1() populate status-format[0] and status-format[1] with range-based window formatting and style fallback chains for last/bell/activity/silence states.

Sequence Diagram(s)

sequenceDiagram
  participant tmux.conf as tmux.conf (user config)
  participant main
  participant configure_dual_status_bars
  participant build_status_format_0
  participant build_status_format_1

  tmux.conf->>main: status_lines=2 (or unset → "1")
  alt status_lines == "1"
    main->>main: build_left_status / build_right_status
  else status_lines != "1"
    main->>configure_dual_status_bars: invoke
    configure_dual_status_bars->>configure_dual_status_bars: tmux set status 2
    configure_dual_status_bars->>build_status_format_0: build status-format[0]
    build_status_format_0-->>configure_dual_status_bars: left/center/right format string
    configure_dual_status_bars->>build_status_format_1: build status-format[1]
    build_status_format_1-->>configure_dual_status_bars: left/center/right format string
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 Two bars are better than one, says I,
One line for windows, one stretching high.
status_lines=2 and the screen comes alive,
With bell and last-seen, my sessions thrive.
Hop hop, two rows — what a glorious dive! 🎉

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: porting dual-line status bar support from tmux-powerline to tmux-power.
Description check ✅ Passed The description addresses the motivation (working with many windows with long titles) and confirms testing with themes, though it could be more structured and detailed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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

🧹 Nitpick comments (1)
tmux-power.tmux (1)

352-357: 💤 Low value

Consider explicit validation for status_lines.

The current logic treats any value other than "1" as dual-mode. A user typo like status_lines='yes' or an empty value would silently enable dual status bars. For robustness, you could validate the input:

💡 Optional: explicit value check
-    if [[ "$status_lines" == "1" ]]; then
+    if [[ "$status_lines" == "1" ]]; then
         build_left_status
         build_right_status
+    elif [[ "$status_lines" == "2" ]]; then
+        configure_dual_status_bars
     else
-        configure_dual_status_bars
+        # Fallback to single status bar for invalid values
+        build_left_status
+        build_right_status
     fi

This is optional—the current approach is a common shell pattern and works correctly for intended use.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tmux-power.tmux` around lines 352 - 357, The conditional logic in the
status_lines check currently treats any value other than "1" as dual-mode, which
means typos or unexpected values would silently enable dual status bars without
validation. Add explicit validation for the status_lines variable to ensure it
only accepts known valid values (such as "1" for single mode and perhaps "2" for
dual mode), and handle invalid values appropriately—either by logging an error,
using a default, or failing gracefully. Update the if condition to check for the
specific valid values rather than relying on an else clause that implicitly
accepts everything else.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tmux-power.tmux`:
- Around line 352-357: The conditional logic in the status_lines check currently
treats any value other than "1" as dual-mode, which means typos or unexpected
values would silently enable dual status bars without validation. Add explicit
validation for the status_lines variable to ensure it only accepts known valid
values (such as "1" for single mode and perhaps "2" for dual mode), and handle
invalid values appropriately—either by logging an error, using a default, or
failing gracefully. Update the if condition to check for the specific valid
values rather than relying on an else clause that implicitly accepts everything
else.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2dbd1b8a-7a83-4ee5-af20-714e08f10ca7

📥 Commits

Reviewing files that changed from the base of the PR and between d69c4d7 and f165ee9.

📒 Files selected for processing (1)
  • tmux-power.tmux

@nuffin nuffin force-pushed the feat/dual-status-lines branch from 3ccaa70 to cc2f1e4 Compare June 18, 2026 10:12
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.

2 participants