Scripted Window Actions
Going Further
Now you've seen how Devilspie2 can – over time – make your workflow more efficient by automating all of the fiddly little window management tasks that you do every day by hand, but it includes many other routines, as well, such as making windows invisible from task lists or pagers, placing them always on top of other windows, or centering them in the screen (like a splash screen).
At the time of writing, Devilspie2's manual [3] was very much incomplete and didn't even include examples, but that's what this tutorial is for! You can, however, bring up a rather dry but detailed list of additional window management routines in the README [4] (Figure 3). Let me know how you get on with this handy little tool and how it makes a difference to your daily work! Also check out two other WM tools in the "Alternatives: wmctrl and xdotool" box that provide similar functionality for automating tasks, but with other features and benefits.
Alternatives: wmctrl and xdotool
As you've seen, thanks to Lua scripting, Devilspie2 is quite easy to work with. If you want a smaller tool for interacting directly with windows, though, then take a look at wmctrl
[5]. This is a "command-line tool to interact with an EWMH/NetWM compatible X Window Manager" – which means pretty much all major WMs written (or updated) in the last decade. Examples include Blackbox, IceWM, Englightenment, and Window Maker.
As with Devilspie2, you can use wmctrl to move windows around, resize them, put them on specific workspaces, and do other tasks. It's a more demanding tool to use, in that some familiarity with X Window System underpinnings is important, but the documentation is fairly good. You can even do some more advanced things like changing window titles on the fly and resizing the current desktop.
Another tool that's slightly related is xdotool
[6], which lets you "simulate keyboard input and mouse activity, move and resize windows, etc." (i.e., you can create scripts that send virtual key presses and mouse clicks to windows) (Figure 4). It's especially useful for automating certain tasks, such as clicking on a series of buttons in a complicated dialog, so you can even use it for automatic testing of GUI software. Like wmctrl
, it's not the easiest program to use out of the box and has a somewhat steep learning curve, but it's worth putting in some time to learn the basics. Still, wmctrl
and xdotool
are both included in the package repositories of all big-name distros, so you don't have to go far to find them.
Infos
- Devilspie2: http://www.nongnu.org/devilspie2/
- Lua: https://www.lua.org
- Devilspie2 manual: http://www.gusnan.se/devilspie2/manual.php
- Devilspie2 README: http://git.savannah.gnu.org/cgit/devilspie2.git/plain/README
- wmctrl: http://tripie.sweb.cz/utils/wmctrl/
- xdotool: http://www.semicomplete.com/projects/xdotool
« Previous 1 2
Buy this article as PDF
(incl. VAT)