Skip to content

✨ feat(compact-tabs): open Set Window Title on name double-click - #733

Open
kud wants to merge 1 commit into
gnachman:masterfrom
kud:feat/window-name-click-to-edit
Open

✨ feat(compact-tabs): open Set Window Title on name double-click#733
kud wants to merge 1 commit into
gnachman:masterfrom
kud:feat/window-name-click-to-edit

Conversation

@kud

@kud kud commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

📄 Description

#731 gives the window name a home beside the tabs, but once it's visible there's no way to change it from there — you still have to reach for the Window menu. That's an odd asymmetry: the name is right there, clickable-looking, and clicking it does nothing.

-hitTest: already hands the label the click naturally, because it's a subview sitting on top of the tab bar strip; #731 deliberately forwarded that hit back to _tabBarControl so the label wouldn't intercept drags and double-click-to-zoom. This keeps that forwarding for every other pixel of the strip but lets the name itself keep the hit, then adds a -mouseDown: that reads intent from click count: a double-click asks the delegate to open Set Window Title, anything else calls -performWindowDragWithEvent: — the same call the tab bar strip already relies on to act like a title bar. Because the double-click is spent on the title, the rest of the strip keeps zooming on double-click exactly as before; only the name itself changes behaviour.

Double-click rather than single-click is deliberate: a single click on a title bar is how you focus and drag a window, so spending it here would cost that. But the tension is worth stating plainly rather than glossing — elsewhere in iTerm2 a double-click on chrome consistently means zoom or maximise. On the tab bar it zooms the window; on a session title bar it maximises the pane (-sessionDoubleClickOnTitleBar:-toggleMaximizeSession:). This change makes the window name the one place that gesture means something else. The case for it is that the name is a specific, labelled target rather than generic chrome, and that single-click is already spoken for — but if you would rather keep the double-click language uniform across the app, a context-menu item on the name is the obvious alternative and I am happy to switch. -menuForEvent: also now returns the tab bar's menu when the point is over the name, so taking the double-click doesn't cost the right-click menu that was there before.

Wiring is a single new delegate method, rootTerminalViewDidRequestEditWindowName, calling straight into the existing -editWindowTitle: action — no new UI, just a second way to reach the one that already exists on the Window menu. PSMTabBarControl stays untouched, as in #731.

🔍 Scope

Worth being explicit about one limitation: under the default showWindowNameBesideTabs setting ("When a custom name is set"), the label doesn't exist until a window already has a name, so this gesture can only ever rename a window — it's never how a window gets named the first time. The Window menu remains the only entry point for that.

✅ How to Validate

  1. Theme: Minimal (or Compact). Window → Set Window Title, give it a name, open a second tab so the strip is showing.
  2. Double-click the name — Set Window Title should open.
  3. Single-click-and-drag the name — the window should still move.
  4. Right-click the name — the tab bar's context menu should still appear.
  5. Double-click elsewhere on the strip (not the name) — it should still zoom the window, unaffected.

🛠️ Developer Checklist

  • Code is readable and maintainable
  • Builds clean with no new warnings (tools/build.sh Development)
  • Release notes updated in docs/notes-3.7.txt
  • Manually verified end to end in the running Development build under Minimal — naming a window shows the label, double-clicking it opens Set Window Title, dragging still moves the window, right-click still opens the tab bar menu, and double-clicking elsewhere still zooms. Not exercised by hand: the Compact theme specifically, full screen, and non-top tab bar positions — all early-return via the same predicates ✨ feat(compact-tabs): show the window name beside the tabs in Compact and Minimal #731 already gates on, but untested here.
  • Tests included and passing — there's no test coverage for tab bar mouse handling in this area, and none was added
  • Commits follow Conventional Commits

@kud
kud marked this pull request as ready for review August 18, 2026 22:01
@kud
kud force-pushed the feat/window-name-click-to-edit branch 3 times, most recently from f873e11 to f9e5f42 Compare August 24, 2026 15:48
@kud
kud marked this pull request as draft August 27, 2026 10:43
@kud

kud commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Dependency with another PR. I prefer to set it as a draft for now.

- Add `-[PseudoTerminal rootTerminalViewDidRequestEditWindowName]`, wired to the existing `-editWindowTitle:` action, so the delegate can trigger the rename sheet
- `iTermRootTerminalView.m`: `-mouseDown:` now checks `-pointIsInWindowNameBesideTabs:` and, on a double-click, calls the new delegate method instead of forwarding to `-performWindowDragWithEvent:`; single-click/drag on the name still moves the window as before
- `-menuForEvent:` keeps returning the tab bar's context menu when right-clicking the name, even though the fake title label is hidden, so right-click behavior is unchanged
- `docs/notes-3.7.txt`: document the new double-click-to-edit behavior for the window name beside the tabs
@kud
kud force-pushed the feat/window-name-click-to-edit branch from f9e5f42 to 033ebb0 Compare September 3, 2026 10:39
@kud
kud marked this pull request as ready for review September 3, 2026 10:40
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