• George Nachman's avatar
    Revamp titles in tmux integration · cdadbd0b
    George Nachman authored
    As of tmux 2.6 and later:
    - Windows have names, as always
    - Panes have titles (vended with #{pane_title})
    - Windows kind of have titles. If set-titles is on, the title is formatted by set-titles-string.
    
    We now use the #{pane_title} for session titles. If set-titles is on then we
    use the formatted set-titles-string for the tab title. The window title is the
    current session's title.
    
    In detail:
    
    - Add iTermTmuxOptionMonitor that can request tmux display-message either once
      or periodically for a given format.
    
    - Add KEY_TMUX_PANE_TITLE to hold the tmux pane title. This allows the session
      to communicate the tmux #{pane_title} to the Edit Session dialog. It's not a
      "real" preference. Its only meaning is to exist temporarily to solve this
      problem.
    
    - Eliminate support for interpolated strings in tmux window titles. It was
      unnecessary complexity. It can be added later if anyone cares.
    
    - Remove iTermVariableKeySessionTmuxWindowTitle and
      iTermVariableKeySessionTmuxWindowTitleEval.
    
    - Add iTermVariableKeySessionTmuxPaneTitle.
    
    - When using tmux 2.6+, rename panes programatically when changing a session
      title with Edit Session. Otherwise, rename the window as before.
    
    - Pull the #{pane_title} periodically—on initialization, and various other
      times like when we get a control sequence that would rename a pane.
    
    - Load set-titles and set-titles-string on connecting to tmux to decide how
      window titles ought to work.
    
    - Make PTYTab add the tmux indicator ↣ to the title just before setting the
      label. It pulls the window name from the new
      iTermVariableKeyTabTmuxWindowName variable. Use that instead of the session's
      tmuxWindowTitleEval.
    
    - PTYTab pulls the window title periodically, such as after creation, when we
      see a window was renamed, or when the active session changes.
    
    - Use the title override variable to show iTermVariableKeyTabTmuxWindowTitle as
      the tab title when set-title is on.
    
    - When you rename a tab with Edit Session or Edit Tab Title, rename the tmux
      window. This works because the default set-title-string includes the window
      name.
    
    - Change edit session to call iterm2.set_title on the session-being-edited's
      tab rather than updating the tabTitleOverrideFormat directly so it can rename
      the window when using tmux.
    
    - Don't crash if you call a method with a nil completion block.
    
    - Change the builtin session title function to prefer the tmux window name for
      window titles or the pane title for session titles.
    
    - Fix the data type of iTermVariableScope.tabID to be a string.
    
    Here are the results of my tests
    
                     3.2.9/2.9a       3.3/2.5          3.3/2.9a
    OSC 0            1                3                3
    OSC 2            -                -                5
    esc k            1                4                6
    Edit Session     2                4                3
    Rename window    2                4                4
    
    -: No effect.
    1: Session is renamed, but is not durable.
    2: All panes and tab are renamed. Durable.
    3: Rename just session. Durable.
    4: Rename tab/tmux window. Durable.
    5: Updates pane title. Durable.
    6: Causes pane title to be updated by iTerm2, but does not seem to affect tmux.
    cdadbd0b
Name
Last commit
Last update
..
AboutWindow.xib Loading commit data...
AddressBook.strings Loading commit data...
AdvancedWorkingDirectoryWindow.xib Loading commit data...
Autocomplete.xib Loading commit data...
BulkCopyProfilePreferences.xib Loading commit data...
CommandHistoryPopup.xib Loading commit data...
DirectoriesPopup.xib Loading commit data...
FindView.xib Loading commit data...
GlobalSearch.xib Loading commit data...
InstantReplay.xib Loading commit data...
MainMenu.strings Loading commit data...
MainMenu.xib Loading commit data...
MiniPasteView.xib Loading commit data...
MinimalFindView.xib Loading commit data...
MinimalPasteView.xib Loading commit data...
NumberOfSpacesAccessoryView.xib Loading commit data...
PasteView.xib Loading commit data...
PasteboardHistory.xib Loading commit data...
PreferencePanel.strings Loading commit data...
PreferencePanel.xib Loading commit data...
ProfilesWindow.xib Loading commit data...
PseudoTerminal.strings Loading commit data...
PseudoTerminal.xib Loading commit data...
SplitPanel.xib Loading commit data...
TmuxDashboard.xib Loading commit data...
configPanel.strings Loading commit data...
iTerm.strings Loading commit data...
iTermEditKeyActionWindowController.xib Loading commit data...
iTermKeyMapping.xib Loading commit data...
iTermOpenQuicklyWindowController.xib Loading commit data...
iTermParameterPanelWindowController.xib Loading commit data...
iTermPasswordManager.xib Loading commit data...
iTermPasteSpecialViewController.xib Loading commit data...
iTermPasteSpecialWindow.xib Loading commit data...
iTermWindowShortcutAccessoryView.xib Loading commit data...