Devil's Pie ("devilspie") is an utility that lets you perform various actions on windows. While some of its functionality can be found in Compiz, there's one cool feature that Devilspie provides which is not available in Compiz (that I know of anyway): minimizing a window as soon as it's open.
Devilspie is also very useful for those that do not use Compiz. It can perform the following actions on the windows you open: minimize, move them to a certain workspace, maximize, fullscreen, unmaximize, maximize vertically or horizontally, pin (visible on all workspaces), undecorate, resize windows, set the opacity and more.
To install Devilspie in Ubuntu, click the button below:
If you prefer to install it via command line, use the following:
sudo apt-get install devilspie
1. How to use Devilspie without a GUI
There is a GUI to configure Devilspie (see "2. How to use Devilspie with a GUI"), however I've started with the manual way of doing this so you'll understand how it works.
To use Devilspie, you'll need to create a configuration file for each application you want to start minimized, maximized and so on. Firstly, create a folder called ".devilspie" in your home directory:
Start application minimized
Now let's say you want to create a rule to start a Terminal minimized. To do this, you would have to create a file called "terminal.ds" in the ~/.devilspie folder you've just created and paste this:
(if (is (application_name) "Terminal") (begin (minimize) ) )
Then save the file and start Devilspie via a terminal:
Now when you open a terminal (Gnome Terminal), it should be automatically minimized. Besides "application_name" you can also match a window by its "window_name", "window_role", "window_class" or "window_xid". But how do you know a window name, class and so on? Create a file called "debug.ds" in the ~/.devilspie folder and paste this:
Now when you start Devilspie in a terminal, it should output the window class, name and so on for every running window / application.
For more info, visit the Devilspie documentation page.
Start application on X workspace / viewport
You can already do this using Compiz, but it's a cool feature for those that use Metacity. For the same application (Terminal), to set it to open on workspace 2 you would need to use the following configuration in the "terminal.ds" file:
(if (is (application_name) "Terminal") (begin (set_workspace 3) ) )
"set_workspace" only works with Metacity. If you want to do while using Compiz, use "set_viewport" instead of "set_workspace".
More actions at once
What if you want to open an application on a workspace AND set it to start minimized? Use this:
(if (is (application_name) "Terminal") (begin (set_viewport 3) (minimize) ) )
2. How to use Devilspie with a GUI (gDevilspie)
There is a GUI which makes configuring Devilspie easier. To install it in Ubuntu, click the button below:
or open a terminal and copy/paste the following command to install it:
sudo apt-get install gdevilspie
Using gDevilspie you can start or stop Devilspie, set it to start automatically at login, add window rules, get a window name, class and so on automatically and assign actions as well as directly paste the code.
To add a new rule using gDevilspie, click "Add", under "Create a new rule named" enter a name for your new rule:
Then select "window_class" (or some other matching rule) and click the "Get" button at the bottom of the window - this will display all open windows and you can select a window for which gDevilspie will automatically fill:
Now, on the "Actions" tab select the action you want to apply for your new window matching rule, like minimize, maximize and so on:
Important: if using "window_class" doesn't work for you, try "application_name" or "window_name". Further more, in my test using the exact window_class (or application_name) didn't always work so in some cases it's best to use "matches":
Also see: Make Applications Always Open On A Given Workspace (Viewport) Using Compiz