[Feature] Touch bar: scripted dynamic buttons
- iTerm2 version: 3.2.0
- OS version: 10.13.6
It would be awesome to be able to dynamically create/remove buttons in the touch bar, on which we can set the text and set a command that they run.
This is similar to setting the text on the "Status" button, but it would allow creating/removing buttons on the fly.
This would be entirely controlled by escape sequences and an
it2* integration command. There's no way iTerm2 can anticipate every possible use case for dynamic buttons.
It would potentially need push/pop functionality like SetKeyLabel.
Potential use cases:
- When I have tmux running, I can have a script that runs
tmux list-sessionsand creates a button for each session. Touching the button will send a
^b :attach -t other-window
- When I am in a git session, creates buttons for "checkout", "commit" but only when there are staged files, "add" but only when there are unstaged changes, etc. Potentially even allows somebody to get the most recent 5 branches and create buttons that will send a
git checkout [branch].
- Any other situations where a person wants to run a script that will create a button set and add it to the touch bar.
The reason I don't want to be able to re-assign and re-label the
Fn keys is because at any point, I might have to use them. E.g., if in the tmux use case, I may want buttons with my open tmux sessions, but in any of those sessions I may be running an application for which I need to hit F2.
If it could eventually change colors of buttons/text (#5763) as well, that would be super awesome.