Add keyboard shortcuts to rename tabs/windows and cycle tab color - #672
Add keyboard shortcuts to rename tabs/windows and cycle tab color#672fabdelgado wants to merge 2 commits into
Conversation
Renaming a tab/window and setting a tab color already existed but were buried in the View menu with no key equivalents, which makes organizing a window full of tabs (e.g. many concurrent agents) slow. This wires up default shortcuts and adds a one-keystroke color cycle: - Edit Tab Title: Ctrl-Cmd-R (reuses editTabTitle:) - Edit Window Title: Ctrl-Opt-Cmd-R (reuses editWindowTitle:) - Cycle Tab Color: Ctrl-Cmd-E (new cycleTabColor: action) cycleTabColor: steps the current tab through the tabColorMenuOptions presets, then to no color, then wraps around. The shared "apply a color to every session in a tab" logic is hoisted into applyTabColor:toTab:, used by both the color menu and the new shortcut. Preset parsing is extracted to +[ColorsMenuItemView presetTabColors] so the menu and the cycle share one source of truth.
|
Can't use control-command or control-opt-command for a shortcut because they are reserved for creating new windows/tabs. Commit e376ba3 adds a spreadsheet documenting the existing shortcuts. Cycle tab color is worth keeping, though. Just revert the shortcut changes. |
Per review: Ctrl-Cmd and Ctrl-Opt-Cmd are reserved for creating new windows/tabs, so the Edit Tab Title, Edit Window Title, and Cycle Tab Color key equivalents are removed. The cycleTabColor: action and its menu item are kept (now with no default shortcut), along with the shared applyTabColor:toTab: and +[ColorsMenuItemView presetTabColors] refactors.
|
Ready the changes!, thanks! |
|
Thanks for this! The functionality is nice, but I don't think the shortcut side is wired up the way the description implies. The PR title/description say it "wires up default shortcuts" (Ctrl-Cmd-R / Ctrl-Opt-Cmd-R / Ctrl-Cmd-E), but as far as I can tell no shortcut is actually bound by any mechanism:
More importantly, this should really be a first-class key binding action rather than a menu key equivalent. iTerm2 lets users assign keys to actions in Preferences > Keys, and hardcoding default menu key equivalents tends to collide with users' existing bindings and can't be remapped easily. The right home for something like "Cycle Tab Color" is the
The Objective-C refactor itself looks good: hoisting Two smaller notes if you keep a menu item too:
|
Renaming a tab/window and setting a tab color already existed but were buried in the View menu with no key equivalents, which makes organizing a window full of tabs (e.g. many concurrent agents) slow.
This wires up default shortcuts and adds a one-keystroke color cycle:
cycleTabColor: steps the current tab through the tabColorMenuOptions presets, then to no color, then wraps around. The shared "apply a color to every session in a tab" logic is hoisted into applyTabColor:toTab:, used by both the color menu and the new shortcut. Preset parsing is extracted to +[ColorsMenuItemView presetTabColors] so the menu and the cycle share one source of truth.