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.
| Print article | This entry was posted by rob on May 27, 2010 at 17:32, and is filed under X11. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |