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:

  1. Make sure devilspie is running (ps ef | grep devilspie, etc)
  2. Double check your application_name (or similar) via debug
  3. 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!

I post tutorials very regularly on this site. You may want to consider subscribing to the RSS feed. Or if you'd prefer these tips sent to your inbox you can use Email Subscriptions.

Related Posts

Random Posts

Comments

19 Responses to “How To Set Default Workspace, Size and Window Effects in Gnome”

  1. Maxo on July 25th, 2007 12:13 pm

    I really like this tool as well. I think it’s abilities should be built in at the OS level. Maybe an option in the right-click menu to set options for the program.

  2. Josh on July 25th, 2007 12:28 pm

    I agree with Maxo. This is something that should already be in Gnome. I wish the Gnome developers would stop confusing “simple” with “crippled.” O

    [douchebaggery]
    On another note, “devilspie” is a stupid name and asking new Linux users to edit files in vim is probably not wise. Wouldn’t it make sense to have a GUI to do these tasks? I never cease to be amazed at how low a priority user interfaces are given in the Linux world. UI should be one of the first considerations in applications development for Linux, just like it is for those other operating systems.
    [/douchebaggery]

  3. University Update - Firefox - How To Set Default Workspace, Size and Window Effects in Gnome on July 25th, 2007 12:52 pm

    [...] Link to Article firefox How To Set Default Workspace, Size and Window Effects in Gnome » [...]

  4. Freddy Martinez on July 25th, 2007 1:14 pm

    Anyway to do this in KDE?

  5. Stephen Weeks on July 25th, 2007 7:23 pm

    I’d just like to mention here that this functionality is built in to e17, has been for quite a while, and is easily accessible in a clicky gui config in the window menu.

    Just set your window up how you want it to be, click ‘remember’ in the window menu, and choose the attributes that you want remembered. Very nice.

  6. Niels on July 26th, 2007 4:50 am

    Is there anyway to set it up such that firefox 2 loads on the 2nd virtual desktop when you log in, but should you just happen to open firefox it will open on the desktop you’re on?

  7. chi on July 26th, 2007 5:44 am

    I wrote down some examples [1] too a while ago. Not all of them work perfectly (like the one for gimp). Anyway, I can`t live without devilspie anymore ;-).

    [1] http://www.chimeric.de/snippets/linux/devilspie#examples

  8. Jim Priest on July 26th, 2007 9:52 am

    Sweet! I had seen something similar that would do this in Windows - this is great -I agree - why isn’t this baked into Gnome by default? Can’t wait to get home and give it a go…

  9. anonymous coward on July 26th, 2007 9:03 pm

    Stephen Weeks: When will e17 be released? I’d love to be able to install it from my distro’s repositories.

  10. Joe A on July 28th, 2007 1:31 am

    Can I use this to make new IM (with pidgin 2.0.2) windows not take focus? Because that would just take me another step above AIM client users :P

  11. anonymous on August 15th, 2007 11:43 pm

    Heheh. KDE’s had this built-in for a while. Click the window icon/menu thingy on the upper left corner of any window in KDE, then choose advanced -> special window settings, and a neat little dialog pops up. you can configure window size, which desktop to place the window, keep above/below, and just about every other option. I use this to force my pidgin buddy list to stay docked on the right and maximized vertically with the window borders hidden

  12. tombraun on September 6th, 2007 12:02 am

    Yes, KDE has hat it forever. When I changed from KDE (Novell Desktop Linux) to Gnome (Ubuntu) this was one of the features I really missed. It took me another two years, or so, before I finally discovered devilspie.

    I fully agree with previous posters: This should definitely be part of the standard Gnome capabilities. Even the Gnome developers on their ’simplicity’ trip should admit that a simple ‘remember’ option is not going to confuse anyone.

    Or the ability to modify screensaver settings, for that matter and while we are at it…

  13. High Camp on September 8th, 2007 9:42 pm

    I can’t get it to work. I’m not sure if it matters that I’m running the newest Xubuntu (and I’m a n00b). I’ve set Deilspie to autostart in the applications. I’ve created a directory .devilspie in my home directory. In that home directory I put the Firefox file first to test, then Gvim, then Debug and none of them have worked.

    Anyone have any ideas?

  14. Some Guy on September 14th, 2007 9:48 am

    The Compiz composite window manager with related window rules plug-ins also handles window matching, amongst a slew of other goodies.

  15. victor on September 15th, 2007 4:42 pm

    sorry to be think, but i havent got a clue how i am suppost to entry that data. could you clarify a bit..
    many thanks

  16. TuxJournal.net 2.0 » Archivio » Desktop: mettete le regole alle vostre finestre (3/4) on October 10th, 2007 4:13 pm

    [...] una configurazione particolare, oppure avete tra le mani un piccolo How-To, vi basta andare a questa pagina che vi insegna ad utilizzare l’applicativo in questione abbinandolo a Firefox in [...]

  17. Torsten on December 13th, 2007 10:35 am

    Is it possible to restrict icons to certain workspaces as well?

  18. Luciano on February 27th, 2008 9:57 pm

    Hello,

    Thanks for all the great info! I’ve installed virualbox and devilspie. Only problem is with devlspie cause I keep getting this error and it does not move the windows to other workspaces:

    ** (devilspie:10241): WARNING **: Workspace number 2 does not exist

    (devilspie:10241): Wnck-CRITICAL **: wnck_window_move_to_workspace: assertion `WNCK_IS_WORKSPACE (space)’ failed

    I did not findany solution yet on the many posts i’ve googled..

    Any ideas please??

  19. Luciano on March 1st, 2008 5:38 am

    hello,

    found the answer in ubuntuforums:
    “because of compiz you have to use set_viewport
    instead of set_workspace”

Leave a Reply




    Subscribe to the RSS feed!


    subscribe to the ubuntu tutorials RSS feed

    Get Ubuntu!


    Obama '08


    Obama '08 - Change We Can Believe In

  • Blogroll

  • Ads by Google