I've been looking through the documentation for iTerm2's Python API, trying to figure out a way to get and set the names/titles of
- windows,
- tabs, and
- sessions.
I've also experimented in an iTerm Python REPL, to no avail.
Window title seems to still be settable with the old shell escape codes, e.g. using a function like this:
window_title() {
echo -ne "\e]2;$@\a\e]1;$@\a"
}
But I can't even find alternative ways of setting the session title or the tab title, much less doing so through the Python API.
The relationship between window title, tab title, and session title can be more clearly seen if you look at its effects (assuming session title is set to show the session name--a distinction that can be confusing if they are not set to be the same).