Devil’s Pie
December 9th, 2009
I’ve been using Gnome for almost a year and a half now, and while I have grown to love a lot of the advantages it has, there are still some things I miss about FVWM. From a keyboard shortcut standpoint, many of them were alleviated when I discovered Gnome Do. However, I still found myself missing sticky, transparent shells that would give me a constant view into certain data, be it htop or tailing some files. It was really quick to set up in FVWM, but I had trouble finding a way to remove window decorations from windows in Gnome.
Sure, there are other ways to get the data I’m looking for, but having text rendered directly on the desktop like that just looks damn cool to me. It also intimidates the crap out of non-geeks when they see my office, which I fully admit is a big plus.
I came across a package called Devil’s Pie that gave me a lot more control over windows. Although I was looking for something that would let me actively select a window to give it certain properties (sticky, no decorations, etc), Devil’s Pie instead passively detects new windows and applies settings to them. It’s a mentality shift from my initial thoughts, but I think over time this model will actually be really useful. Plus, it has “pie” in the name, which is just awesome.
With a combination of gnome-terminal profiles/flags and Devil’s Pie configuration, I was able to get my desktop to automatically populate my desktop with all sorts of data. The following description of how is kinda wordy, but it’s really not complicated at all.
Install and Configure Devil’s Pie
sudo yum -y install devilspie mkdir ~/.devilspie touch ~/.devilspie/console.ds
Devil’s Pie reads all configuration files (I believe they have to end in .ds, but don’t quote me on that) in the above directory on startup. Those files define the rules that will be applied to new windows that are created (there’s also a way to ask it to apply rules to all existing windows as well). For this example, I put my rules in a file named console.ds.
(if (contains (window_name) "console" ) (begin (undecorate) (pin) (skip_pager) (skip_tasklist) ) )
There are two main parts to the above configuration. The first is the matching expression to decide if a window should have the rules applied. In this case, I indicate to apply the actions if the window name contains the string “console” (there are also options for “is” and “matches”). I’ll cover where that rule comes into play in a bit.
The actions do the following:
- undecorate – This is primarily what I was going for, I want the window decorations removed. This includes the title bar and border, though you can still use the shortcut key (alt+F8 by default) to resize a window without decorations.
- pin – Make this window available on all workspaces. There are also attributes to control putting a window on a particular workspace, which could be useful in my case since I use 12 workspaces and am, well, pretty anal retentive about having certain applications in certain workspaces.
- skip_pager – Don’t let the window show up in the pager. It removes the clutter in my pager since I don’t consider this a “real” application, just a status-type window.
- skip_tasklist – A little more useful than skip_pager, this keeps the window off the taskbar, for the same rationale as above.
Needless to say, I’m only scratching the surface of all of the actions supported. I haven’t found a good way to find this list yet; the man page says the -l flag will list symbols but when I try it, it just doesn’t do anything.
Run Devil’s Pie
devilspie
Not much to say about that. I’ll talk more about enabling a debug mode later, but I mention it now to say it’s not done through flags. You’ll need to restart it every time you change your confguration files, but once you’re set add it to System -> Preferences -> Startup Applications and you’re good to go on reboots.
Create Gnome Terminal Profile
To summarize above, Devil’s Pie will take care of removing window decorations and keeping it on the visible workspace. We still need to configure Gnome terminal to add some slickness to how it looks. Since I don’t want this slickness on all of my terminals, I created a new profile named “console” with the following changes:
- Background – Transparent background, with the slider set all the way to none.
- Scrolling – Scrollbar is: Disabled
That gives us a completely transparent shell, reflective of its use to simply throw data at me.
Start the Terminal
Now we just need to make sure we start the terminal such that it will use the right profile and will trigger the window detection from Devil’s Pie. Here’s where the matching expression from above comes into play. I don’t want all of my terminals to have no decorations, just specific ones I want to treat in this fashion. When starting the terminal, tell it to use a specific window title that will match our Devil’s Pie rule from above.
gnome-terminal -t console --profile=console --geometry=140x20+1680-0 -e htop
A quick explanation of above:
- -t – Sets the title of the terminal window. This value should match up to the window_name value from the Devil’s Pie configuration.
- –profile – Tells the terminal to use the slick console profile in all of its transparent goodness.
- –geometry – Initially size and place the terminal on my screen.
- -e – Run a specific command when it starts, in this case
htop.
My screenshot above simply uses a similar call to gnome-terminal, passing a tail command to -e and different geometry to get the log tail on the top of the screen.
Two other notes on Devil’s Pie:
There is a UI for editing the configuration files: gdevilspie. It’s handy because you can easily see the different types of matching expressions and actions, however the files it generated didn’t run for me. For some reason, even with one matching expression it still added a blank condition and an “and” statement and closed the conditions block too early. I haven’t looked to closely yet to see what is wrong.
Enabling debugging is as simple as adding another configuration file. I added one named “debug.ds” to my ~/.devilspie directory that contained simply:
(debug)
Once that is in place, running the devilspie executable from the command line output some really useful window information whenever a new window was created.


Jason Dobies: Devil’s Pie | TuxWire : The Linux Blog
December 9th, 2009 at 8:48 pm
[...] the original post: Jason Dobies: Devil’s Pie Share and [...]
Tom Arnold
December 10th, 2009 at 3:25 am
Very helpful! Thank you!