#!/bin/blog --author=p4bl0

the blog where all numbers are written in base 10

Fast window switching

by p4bl0, on
last update by p4bl0, on

It's been a while since I'm considering to switch to a tiling window manager. I'm an Openbox user since a few years and I'm very happy with it. The only thing that annoy me is having to alt-tab this much some times.

So I was thinking about switching to a tiling window manager such as dwm or awesome, but I've always been repelled by having to reconfigure a new window manager from scratch. You see, my Openbox is tailor configured and I don't want to have to spend a lot of time configuring another WM (setting keybindings for stuff I use frequently and for basic window managing, creating a personnal functional and minimalist theme...). Also I've often felt that the 13 inch screen of my laptop would be too small for a tiling WM to be really interesting.

Then, how to solve my problem? As usual, by discussing it with someone... I really should have one of these duck things! So I was talking with a friend when I said something like in fact what I need is a way to switch between windows the same way I swicth between Emacs buffers using ido. To what he answered dunno what you're talking 'bout, I don't use Emacs. Tssssk. Stupid Vim users... ;-)

After that, I immediatly thougth that using wmctrl I could actually do something approaching a lot what I wanted quite easily. And the plus side would be that it would instantly work with every single standard-compliant WM.

So here it is, a dead simple shell script thanks to zenity:

#!/bin/sh
WIN=`zenity --entry --title="wido" --text="Switch to window?"`
wmctrl -a $WIN
if [ "$?" = "1" ]; then
  wmctrl -x -a $WIN
fi

I bound it to W-s in my Openbox configuration. W is the Windows key, which I use for everything WM related, and 's' is for "switching". When I hit W-s a dialog appear with a focused text field in which I can type any part of a window class or title, and when I hit enter I immediatly swicth to the window I wanted (also switching desktop if needed).

If like me, you love to keep things simple and stupid, give it a try, it's awesome.

If you have any remark about this blog or if you want to react to this article feel free to send me an email at "pablo <r@uzy dot me>".