Among the many cool things that I’ve learned this week at Ubuntu Live there is one that I’m definitely going to keep using! Quickly, before I get started, I need to link back to the Ubuntu Forums post that started this whole thing. There is also a lot more examples and extensions on the wiki, seen here. Unfortunately, outside of these, there is very limited documentation on the web for this tool, so you wont find much more than what you see here. If you do please post a comment with a link.
There are a few steps to this full tutorial so get comfortable and follow along.
Installation
To get the features of this tutorial we will need to install a quick package. It’s pretty small and should just take a minute or two to download and install. Use the following command, or install the package using your favorite package manager:
sudo aptitude install devilspie
What exactly does this package actually do? From the package description:
This tool will find windows as they are created and perform actions on them, such as resizing, moving to another workspace, or pinning them to all workspaces.
In english? You can basically set rules for your favorite applications and make sure they load on the appropriate virtual desktop, at the certain sizes, etc. This has been something that I wish I had for a while and never really looked into. A have a nice organization of applications between my desktops, but all done manually. This automates the whole thing instead.
Configuring
Now that we’ve got the package installed we need to set the configuration of what we’d like it to do.
Create a new directory to store your new devilspie-related configuration file (yes, once you start using this you’ll create more and more–you want them organized). Use the following:
mkdir ~/.devilspie
After this is created we’ll create our custom configuration for the regular applications we launch. For example:
vim ~/.devilspie/firefox.ds
Paste in the following config to your new file:
(if
(is (application_name) "Firefox")
(begin
(set_workspace 2)
(maximize)
)
)
Basically what this is doing is watching for anything launched using the application_name “Firefox”, and give it the following features and options. It’ll load it on virtual desktop number 2 and set the window to maximize. Pretty basic, but so far this has been impossible in gnome. Of course if you’d like it to always load on virtual desktop 1,3,4, etc simply change the number to your preference.
Some more examples for common applications that I use listed below:
vim ~/.devilspie/thunderbird.ds
Paste in the following config to your new file:
(if
(is (application_name) "Thunderbird")
(begin
(set_workspace 3)
(maximize)
)
)
..or for beep-media-player to be on all desktops:
vim ~/.devilspie/bmp.ds
(if (is (application_name) "Beep Media Player") (pin))
…you get the idea. If you’d like to create your own custom rules create a new file in the .devilspie directory and create a debug.ds file. Within that file put:
(debug)
The next time you run devilspie it will read any of the files within .devilspie, which will now include this debugging option. You will see from the debug output the detected application_name of each currently running application. If you don’t know the proper name to use for creating your own rules you may want to use this debug option to help you along.
Persistence
Lastly I’m sure you’ll want these features to run all the time, so you’ll need to set the devilspie application to autostart. You may want to add devilspie to your “Applications > Preferences > Sessions”, which will make it start each time you log in, and read your created window customization options.
Troubleshooting
If you notice your rules don’t seem to be working try the following:
- Make sure devilspie is running (ps ef | grep devilspie, etc)
- Double check your application_name (or similar) via debug
- Double check your *.ds config file syntax
Enjoy. Please leave comments with customizations that you’ve made below. Considering the lack of documentation for this project a good list of examples would be great!