Image of the glider from the Game of Life by John Conway
Skip to content

Change Window Shortcuts in Irssi

I love Irssi in combination with screen. It is a beautiful thing. For those of you who don't use it, try it. You'll never go back.

Getting the hang of windows in Irssi can be somewhat tricky when first using it, because everything is command line. So, changing windows is done using the keyboard. Pressing 'Esc' then a number (0-9) will take you to that window (0 = 10), as will 'Alt (0-9)' and 'Ctrl+(N,P)'. But, if you are a power user, you probably have more than 10 windows open at any given time. How do you get to those windows? 'Ctrl N' will take you to the next window and 'Ctrl P' will take you to the previous, but they are all in succession. How do you jump from window 11 to window 15 for example. You could type '/window 15' to take you there and '/window 11' to get you back, but that is too much work.

Irssi is set up with QWERTY users in mind, as it should be. As such, if you are using the QWERTY layout, then 'Esc q' (or 'Alt q') will take you to window 11, 'Esc w' will take you to 12, 'Esc e' to 13 and so on for the entire top row of letters. That takes care of the first 20 windows. But, if you are a Dvorak user as I am, the top row of letters in QWERTY are scattered about the keys, and it doesn't make logical sense for which window shortcut is where. So, how to change this?

In step the '/alias' command in Irssi. Without going into detail, the '/alias' command gives you the ability to create your own aliases. With it, you can change keyboard bindings as you please. As such, we should be able to create an alias that will allow us to use the Dvorak layout when switching windows and another alias for QWERTY. In fact, that is exactly what we can do.

In the alias, we will need to delete the current key bindings, then assign the new ones to the appropriate keys. "bind -delete meta-q" will delete the assinment to the 'q' key, and "bind meta-' change_window 11" will change the key assignment to the tick (') to go to window 11. Seperate each bind with a semicolon and we're set. Check it out:

/alias dvorak

/alias dvorak bind -delete meta-q;bind -delete meta-w;bind -delete meta-e;bind -delete meta-r;bind -delete meta-t;bind -delete meta-y;bind -delete meta-u;bind -delete meta-i;bind -delete meta-o;bind -delete meta-p;bind -delete meta-f;bind meta-' change_window 11;bind meta-, change_window 12;bind meta-. change_window 13;bind meta-p change_window 14;bind meta-y change_window 15;bind meta-f change_window 16;bind meta-g change_window 17;bind meta-c change_window 18;bind meta-r change_window 19;bind meta-l change_window 20

/alias qwerty

/alias qwerty bind -delete meta-';bind -delete meta-,;bind -delete meta-.;bind -delete meta-p;bind -delete meta-y;bind -delete meta-f;bind -delete meta-g;bind -delete meta-c;bind -delete meta-r;bind -delete meta-l;bind meta-q change_window 11;bind meta-w change_window 12;bind meta-e change_window 13;bind meta-r change_window 14;bind meta-t change_window 15;bind meta-y change_window 16;bind meta-u change_window 17;bind meta-i change_window 18;bind meta-o change_window 19;bind meta-p change_window 20

Now, when in Irssi, I just type '/dvorak' and I have the entire top row of my keyboard, using the Dvorak layout, devoted to changing windows 11 through 20, using either the 'Esc' or 'Alt' keys. Type '/qwerty', and it is set back to the QWERTY layout for those shortcuts.


{ 4 } Comments