Skip to content

feat: optionally show the hostname in the desktop tab bar - #2562

Closed
dhh wants to merge 4 commits into
herdrdev:masterfrom
omacom-io:feature/tab-bar-hostname
Closed

feat: optionally show the hostname in the desktop tab bar#2562
dhh wants to merge 4 commits into
herdrdev:masterfrom
omacom-io:feature/tab-bar-hostname

Conversation

@dhh

@dhh dhh commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add ui.tab_bar_hostname (default false) that shows the machine hostname at the right edge of the desktop tab bar, in the inactive-tab text color — tmux's #h in status-right
  • the hostname resolves on the machine that renders the UI, i.e. the server: herdr --remote user@host shows the remote machine's name, which is the identity that matters when you're juggling local and remote sessions
  • the reserved right-edge width is excluded from tab layout in compute_tab_bar_view's callers, so tabs, trailing controls, and the overflow ellipsis never render underneath the label
  • no new dependencies: libc::gethostname on unix (libc is already a direct dependency), COMPUTERNAME on Windows, None on other targets, following the src/platform/ house pattern
  • resolved once at startup and on config reload, not per frame

Configuration

[ui]
tab_bar_hostname = true

Testing

  • new unit tests: hostname renders at the right edge with reserved layout space when enabled, and the row is untouched when disabled
  • config default + TOML parse asserted in the existing ui config test
  • cargo fmt --check, full cargo test suite, and scripts/config_reference_check.py pass locally

Add ui.tab_bar_hostname to display the machine's hostname at the right
edge of the tab row, like tmux's #h in status-right. The value resolves
where the server renders, so remote sessions show the remote host. Off
by default.
@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 9, 2026
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds the ui.tab_bar_hostname setting, resolves the machine hostname into application state, and displays it at the desktop tab bar’s right edge. Tab layout and overflow indicators now avoid the reserved hostname area.

Changes

Hostname tab bar display

Layer / File(s) Summary
Hostname configuration and state
src/config/model.rs, src/platform/mod.rs, src/app/state.rs, src/app/mod.rs
UiConfig::tab_bar_hostname defaults to false. The application resolves the hostname during startup and configuration reload. Platform-specific resolution supports Unix and Windows.
Hostname-aware tab bar layout
src/ui/tabs.rs, src/ui.rs, src/app/actions.rs
The tab bar reserves space for the hostname. Tabs and overflow indicators use the reduced content area.
Hostname documentation and validation
docs/next/..., src/main.rs, src/config/model.rs, src/ui/tabs.rs
Configuration documentation describes local and remote hostname display. Tests cover parsing, rendering, sanitization, boundary reservation, omission, and disabled behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Configuration
  participant App
  participant Platform
  participant AppState
  participant TabBar
  Configuration->>App: tab_bar_hostname setting
  App->>Platform: resolve hostname when enabled
  Platform-->>App: optional hostname
  App->>AppState: update tab_bar_hostname
  AppState->>TabBar: provide hostname and tab-bar bounds
  TabBar->>TabBar: reserve hostname area and render tabs
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 68.75% 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 clearly and concisely describes the primary change: optional hostname display in the desktop tab bar.
Description check ✅ Passed The description directly explains the hostname setting, layout behavior, platform handling, and tests included in the changeset.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b89b1741-397b-4e08-af05-3122e5e5f9b6

📥 Commits

Reviewing files that changed from the base of the PR and between e7c38ab and 9ae9f39.

📒 Files selected for processing (10)
  • docs/next/CHANGELOG.md
  • docs/next/website/src/data/config-reference.json
  • src/app/actions.rs
  • src/app/mod.rs
  • src/app/state.rs
  • src/config/model.rs
  • src/main.rs
  • src/platform/mod.rs
  • src/ui.rs
  • src/ui/tabs.rs

Comment thread src/ui/tabs.rs Outdated
@greptile-apps

greptile-apps Bot commented Aug 9, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds an opt-in hostname label to the desktop tab bar, resolves it at startup and config reload, and reserves tab-layout space for it. The follow-up minimum-width guard still undercounts the controls used by an overflowing mouse-enabled tab bar.

  • Adds ui.tab_bar_hostname, its documentation, defaults, and live-reload handling.
  • Resolves hostnames through the platform layer and sanitizes control characters before rendering.
  • Reserves right-edge space while attempting to preserve a usable interactive tab strip.

Confidence Score: 4/5

The PR is not yet safe to merge because the hostname guard can still shrink an overflowing tab below the usable minimum it is intended to preserve.

In the overflow layout, the accepted 14-column content area must hold two three-column scroll controls, a three-column new-tab control, and a tab, leaving only five columns for that tab; the guard must account for the left scroll control before the fix is complete.

Files Needing Attention: src/ui/tabs.rs

Important Files Changed

Filename Overview
src/ui/tabs.rs Adds hostname rendering and reservation, but the overflow threshold omits the left scroll button and can compress the visible tab below its declared minimum.
src/ui.rs Applies the hostname-adjusted content area consistently when computing desktop tab geometry.
src/app/actions.rs Uses the same adjusted content area when refreshing tab hit regions after mutations.
src/app/mod.rs Resolves and updates the optional hostname during initialization and valid UI config reloads.
src/platform/mod.rs Adds platform-specific hostname resolution for Unix, Windows, and unsupported targets.
src/config/model.rs Adds the opt-in UI configuration field with a false default.

Reviews (3): Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." | Re-trigger Greptile

Comment thread src/ui/tabs.rs Outdated
…ostname

# Conflicts:
#	docs/next/CHANGELOG.md

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bb6cd73e-1f5c-421f-bda0-3dd3600cb150

📥 Commits

Reviewing files that changed from the base of the PR and between 9ae9f39 and 21b314b.

📒 Files selected for processing (5)
  • docs/next/CHANGELOG.md
  • docs/next/website/src/data/config-reference.json
  • src/config/model.rs
  • src/main.rs
  • src/ui/tabs.rs
🚧 Files skipped from review as they are similar to previous changes (4)
  • docs/next/website/src/data/config-reference.json
  • docs/next/CHANGELOG.md
  • src/main.rs
  • src/config/model.rs

Comment thread src/ui/tabs.rs
Comment on lines +15 to +17
// The narrowest tab strip worth keeping interactive: one minimum-width tab
// plus the trailing controls. Decorations yield below this.
const MIN_TAB_STRIP_WIDTH: u16 = MIN_TAB_WIDTH + NEW_TAB_WIDTH + TAB_SCROLL_BUTTON_WIDTH;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Reserve both scroll buttons in MIN_TAB_STRIP_WIDTH.

Line 17 includes only one TAB_SCROLL_BUTTON_WIDTH. In overflow mode, compute_tab_bar_view() uses a left scroll button and reserves a right scroll button with the new-tab control. A hostname can therefore remain visible while the tab area becomes narrower than MIN_TAB_WIDTH.

Include both scroll buttons. Add a regression test that forces overflow at this boundary.

Proposed fix
-const MIN_TAB_STRIP_WIDTH: u16 = MIN_TAB_WIDTH + NEW_TAB_WIDTH + TAB_SCROLL_BUTTON_WIDTH;
+const MIN_TAB_STRIP_WIDTH: u16 =
+    MIN_TAB_WIDTH + NEW_TAB_WIDTH + (TAB_SCROLL_BUTTON_WIDTH * 2);

Comment thread src/ui/tabs.rs
const TAB_SCROLL_BUTTON_WIDTH: u16 = 3;
// The narrowest tab strip worth keeping interactive: one minimum-width tab
// plus the trailing controls. Decorations yield below this.
const MIN_TAB_STRIP_WIDTH: u16 = MIN_TAB_WIDTH + NEW_TAB_WIDTH + TAB_SCROLL_BUTTON_WIDTH;

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 Hostname undercounts overflow controls

When mouse capture is enabled and tabs overflow with 14–16 columns remaining after hostname reservation, the threshold omits the left scroll button, causing the visible tab to shrink to 5–7 columns instead of preserving its eight-column minimum.

Suggested change
const MIN_TAB_STRIP_WIDTH: u16 = MIN_TAB_WIDTH + NEW_TAB_WIDTH + TAB_SCROLL_BUTTON_WIDTH;
const MIN_TAB_STRIP_WIDTH: u16 =
MIN_TAB_WIDTH + NEW_TAB_WIDTH + TAB_SCROLL_BUTTON_WIDTH + TAB_SCROLL_BUTTON_WIDTH;

@ogulcancelik

ogulcancelik commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

superseded by #2586 with the new ui.tab_bar_right

@kangal-bot kangal-bot removed the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 9, 2026
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.

3 participants