How hide/open tmux window from command line

515 views
Skip to first unread message

David Rees

unread,
Feb 8, 2020, 8:32:01 PM2/8/20
to iterm2-discuss
Is there a way hide and open a tmux window from the command line (like a normal tmux command)? The only way I have found to do is via tmux Dashboard or Cmd-W for hiding.

Thanks!

George Nachman

unread,
Feb 8, 2020, 8:38:42 PM2/8/20
to iterm2-...@googlegroups.com
No, there's no way to do it from the command line. This could be added to the Python API, though. Would you mind filing a feature request and outline your use case? You can create a new issue here: https://iterm2.com/bugs

On Sat, Feb 8, 2020 at 5:32 PM David Rees <da...@ubiqsoft.com> wrote:
Is there a way hide and open a tmux window from the command line (like a normal tmux command)? The only way I have found to do is via tmux Dashboard or Cmd-W for hiding.

Thanks!

--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iterm2-discuss/2a23a492-f0ad-4928-835a-4e2622a72ae3%40googlegroups.com.

Rees, David

unread,
Feb 9, 2020, 9:15:05 PM2/9/20
to iterm2-...@googlegroups.com
Thanks, I did find `async_set_tmux_window_visible(tmux_window_id: str, visible: bool)` which seems to be close to what I am looking for?

One thing I am missing in the iTerm python docs is how to map from tmux `session_name` and `window_name` to the iTerm2 `tmux_window_id`. That would allow managing iTerm2 windows in the context of their tmux names.

See a possible example below. First the user lists the tmux windows along with their iTerm2 status (open/hidden). And they can also hide/close them using the tmux session/window names. The example shows it using the command, but I do understand I would need to do it through the python API (which I still need to play with).

$ tmux display-message -p "#S"
my_session_name
$ my-iterm-script list-tmux-windows
0: first* (1 panes) [133x67] [layout 6698,133x67,0,0,19] @19 (active) (iTerm2 open)
1: second (1 panes) [139x43] [layout 5e12,139x43,0,0,32] @32 (iTerm2 hidden)
2: third (1 panes) [119x28] [layout 65d4,119x28,0,0,34] @34 (iTerm2 open)
$ my-iterm-script open-tmux-window "my_session_name:second"
<iTerm2 window associated with tmux_window second is unhidden>
$ my-iterm-script close-tmux-window "my_session_name:third"
<iTerm2 window associated with tmux_window third is hidden>

Is something like that possible or do I need to file a feature request for the name mapping?

Thanks!
dave


You received this message because you are subscribed to a topic in the Google Groups "iterm2-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/iterm2-discuss/mrOqP3B1kXo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to iterm2-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iterm2-discuss/CAB5RqonyhNE_3ZTHX1iPmZMPnQByvMmskMEvRYxCoy6eswFxzw%40mail.gmail.com.

George Nachman

unread,
Feb 14, 2020, 2:02:11 AM2/14/20
to iterm2-...@googlegroups.com
Indeed, async_set_tmux_window_visible is what you want.

You can get the window ID from `Tab.tmux_window_id` (tmux windows are mapped onto tabs).

tmux sessions are not exposed in the API. Would you mind filing a feature request for this? https://iterm2.com/bugs

David Rees

unread,
Feb 17, 2020, 12:34:02 PM2/17/20
to iterm2-discuss
Thanks. I filed Python API Tab object should provide more tmux information (#8703) · Issues · George Nachman / iterm2 · GitLab. In it I also suggested adding session and window names also.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "iterm2-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/iterm2-discuss/mrOqP3B1kXo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to iterm2-...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages