I have been messing with TMUX, and I am liking the configuration abilities.

The window list at the bottom makes me think that the same shortcut for changing windows in Irssi, should work in TMUX, but it doesn't.

So at the moment, I have to press C-b then a number to get that window open. I am happy having C-b for my normal prefix, (eg for C-b ? for help, C-b : command entry) But it would be cool if I could use both C-b+Numkey and Alt+NumKey for changing tabs.

It would be even cooler if it could detect if a window is showing Irssi, and then ignore the Alt+NumKey, so that I can still change between Irssi windows.

1 Answer 1


Switching windows with Alt can be done by adding:

# switch windows alt+number
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9

to your ~/.tmux.conf This is from: https://github.com/proft/dotfiles/blob/master/.tmux.conf

Further more, to make it not do this if irssi is in the active window:

#switch windows alt+number, unless we are running irssi
bind -n M-1 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 1' 'send M-1'
bind -n M-2 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 2' 'send M-2'
bind -n M-3 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 3' 'send M-3'
bind -n M-4 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 4' 'send M-4'
bind -n M-5 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 5' 'send M-5'
bind -n M-6 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 6' 'send M-6'
bind -n M-7 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 7' 'send M-7'
bind -n M-8 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 8' 'send M-8'
bind -n M-9 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 9' 'send M-9'
bind -n M-0 if 'test `tmux list-panes -F "#W"` != "irssi"' 'select-window -t 0' 'send M-0'

Which roughly reads Bind key [without requiring prefix], to the action of: check if current pane is not named irssi, and if isn't then select the appropriate window, otherwise, resend the key, so that the underlying application [irssi] can can get it.

  • The irssi tip is just what I've been looking for. Thank you.
    – rr-
    Commented Apr 19, 2016 at 8:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .