dwm and swarp

One thing that I really like about dwm is that if you have multiple monitors it treats them somewhat like independent instances of the window manager. So you can keep your mail client open on one monitor and switch between your terminals and web browser on another, and vice-versa.

However this also applies to the mouse pointer, it does not move across when you switch monitors. Of course you may not always want this, but it’s sometimes handy to have the option. I believe that the gottox branch of dwm had this pointer-switching functionality, but dwm-gtx doesn’t seem to be actively maintained these days.

Enter swarp, another tool from the suckless bag of tricks. It’s a simple utility that “warps” the mouse pointer to a given coordinate on your screen.

To get it working with dwm, simply download the tarball, uncompress, compile and install. Like everything else from suckless the dependencies are tiny. Test it out from the command line by specifying different coordinates. Once your happy with the locations that the pointer jumps to, you can add these commands to your dwm config.h to switch from screen to screen:

static const char *warpleft[]  = { "swarp", "100", "500" };
static const char *warpright[]  = { "swarp", "1500", "500" };

Now you need to bind the commands to a key, I use the Windows key as a modifier for a lot of things since it is generally unused:

    { WINKEY,                       XK_w,      spawn,          {.v = warpleft } },
    { WINKEY,                       XK_e,      spawn,          {.v = warpright } },

Because my monitors vaguely face west and east, I chose w & e as the switching keys :)

As usual, compiling, reinstalling and restarting dwm will apply the changes.

DWM config

dwm screenshot

Recently, I started using dwm as my main window manager. At less than 3000 lines of C, it’s somewhat more lightweight than others I’ve used in the past.

The automatic window placement and stacking is really handy, especially when you tend to have a lot of terminals open, it keeps things nice and organised. There is very little to configure, but I did modify the colourscheme a bit to make it darker. I also added some handy key bindings and a few wrapper scripts to allow the window manager to run in a loop so you can restart it without killing all your applications. My config.h and associated scripts are in subversion.

Xorg 7.2, modules sold separately

Since it’s now officially in the FreeBSD ports tree, I decided to upgrade my work desktop to Xorg 7.2 today. The process is mostly painless as long as you are a good user and follow all the steps in /usr/ports/UPDATING – everyone reads that before upgrading anything, right?, right? 😉

The only gotcha I came across related to the modular nature of Xorg, mainly the “where’s my $DRIVER gone to?!” problem. To be honest I’d forgotten about this part even though 7.x has been out for a while, and I probably came across it on various Gentoo upgrades in the past. Running “startx” will simply dump you back out to the console with complaints about not being able to find your keyboard or mouse driver.

However it was pretty easy to infer what the problem was. In the caveats section of the Xorg UPDATING notes they mention you should probably have the x11/xorg meta-port installed. If you don’t have this installed (like me), it’s more than likely Xorg won’t start first go since it’s basically missing all the necessary modules required to load properly. So unless you don’t mind using X without luxuries like a keyboard or mouse you’d better install some drivers.

Luckily these are all packaged up nicely, I simply had to do:

portinstall x11-drivers/xf86-input-keyboard
portinstall xf86-input-mouse
portinstall xf86-video-ati*

* Replace that with your video card – you can probably guess the correct driver to install by looking at /usr/ports/x11-drivers

But..there was still another issue to tackle. Fonts. These are now also their own separate package. When starting X it appeared to get a little further, however it died just before loading the window manager with a message about not being able to find the “fixed” font. So, another portinstall was required:


portinstall xorg-fonts

3rd time lucky, now I have a working Xorg 7.2 install.