terça-feira, 23 de junho de 2009

gDevilspie - gdevilspie - Google Code

gDevilspie - gdevilspie - Google Cod


gDevilspie

A user friendly interface to the devilspie window matching daemon, to create rules easily.

Introduction

System wide installation is handled now, but you it can also run uninstalled. Look it at the README for instructions.

Releases

Third release http://gdevilspie.googlecode.com/files/gdevilspie-0.31.tar.bz2

Second release http://gdevilspie.googlecode.com/files/gdevilspie-0.2.tar.bz2

Initial release http://gdevilspie.googlecode.com/files/gdevilspie-0.1.tar.bz2

Changelog

1 April 2008 Release version 0.31

21 March 2008 Release version 0.2

17 March 2008 Release version 0.1

Screenshots

Main Dialog :

Rule Editor :

Window Selector ( with arabic window titles ):


Comment by Goetz.Waschk, Mar 18, 2008

The usage of the 'full justification' for the window list is wrong. The text 'fill' might work in English, but not in other UI languages.

Comment by pharon, Mar 18, 2008

Can you please explain a little bit, what do you mean ? The window list is a treeview with a text renderer cell packed in each row. Text rendering is just default. The selected row just happens to fill the width exactly.

Comment by Goetz.Waschk, Mar 18, 2008

I was talking about the 'fill' button. You are misusing an icon here.

Comment by pharon, Mar 19, 2008

Oh, I get it, you are right. Will fix it. Thanks :)

Comment by nikolay.kovachev, Mar 19, 2008

There is a bug in geometry action - after restart of app all textboxes (height,width, ...) contain the same full geometry string. Other thing is start/stop devilspie daemon not working on my Ubuntu 7.10 - "The devilspie daemon is not installed...". I am sure that devilspie is installed :).

Comment by pharon, Mar 19, 2008

that's true , the geometry is not parsed properly yet. We are working on it. As to the devilspie launching , can you please tell me where it is installed ? I launch it from /usr/bin/devilspie

Comment by nikolay.kovachev, Mar 20, 2008

In my case path is /usr/local/bin. I use devilspie 0.22 compiled from source.

Comment by pharon, Mar 20, 2008

Ok, all the stuff you reported should be fixed. Expect 0.2 soon if nothing else gets reported for a while :)

Thank you so much for your testing :)

Comment by pharon, Mar 21, 2008

Version 0.2 released. Please test and report. Thank you :)

Comment by nikolay.kovachev, Mar 21, 2008

In 0.2 version start/stop daemon work fine (i look in gnome system monitor) but status text and button text did not change. If i stop daemon and restart gdevilspie status text and button text are correct.

Comment by pharon, Mar 21, 2008

Should be all fixed in SVN. Try testing from there please.

Comment by nikolay.kovachev, Mar 21, 2008

In SVN revision 94 i get this message when start/stop: "The devilspie daemon was started somewhere else. Trying to restart it now." and in terminal: # python gdevilspie.py Traceback (most recent call last):

File "gdevilspie.py", line 489, in on_ToggleDaemon?_clicked
self.toggle_daemon()
File "gdevilspie.py", line 484, in toggle_daemon
self.toggle_daemon()
File "gdevilspie.py", line 483, in toggle_daemon
os.kill(int(status),signal.SIGKILL)
OSError: 3? No such process

After that start/stop button begin to work :). Other thing is width of this button - width is different between Start and Stop button text. Request: double click on "Rule Name" = "Edit"

Comment by pharon, Mar 22, 2008

Wow you are fast :) Will work on it. Sorry for my noobness, I am still new to this :) Thanks for keeping up with me.

Will look into these issues :)

Comment by pharon, Mar 22, 2008

ok, all the issues reported should be fixed , and the enhancement request has been done. Check r95 , keep them coming :)

Thanks.

Comment by nikolay.kovachev, Mar 22, 2008

I delete my last comment because it's still not fixed. After starting of gdevilspie and pressing stop button i get 2 times that message - "The devilspie daemon was started somewhere else. Trying to handle it here" After that button begin to work normal. This is not happen if daemon is stopped before start of gdevilspie - in that case start button work normal. Other thing is - when pressed Stop button resize whole window with few pixels in right direction.

Comment by pharon, Mar 22, 2008

Well that means it is working. By design, this is just an informational message that tells you that the daemon was started outside the program's control and that it will have to kill it.

You think I should remove that message ?

I will look into the resizing issue, it is not happening here..

Comment by pharon, Mar 23, 2008

Last revision should be more consistent.

Comment by nikolay.kovachev, Mar 23, 2008

Yes please remove the message. It's not important for users and tell nothing. Resizing window issue happen only when i press Stop button. When devilspie daemon is stopped and i press Start all is ok. In general there are two issues when Stop button is pressed. Thank you for patience.

Comment by pharon, Mar 23, 2008

it's ok, now try r97 .. /me crosses fingers.

Comment by nikolay.kovachev, Mar 23, 2008

Now most of issues are fixed but... First 2 clicks on Start/Stop didn't change status of daemon in gdevilspie and button say only "Stop". After 3rd click status begin to work. With other words: interface don't indicate change of daemon status with first 2 clicks. Again this behaviour happen when daemon is started before dgevilspie. If daemon is stopped and i start it from gdevilspie all work perfect for me.

Comment by pharon, Mar 24, 2008

I am baffled, this doesn't happen here. I tried a multiple times with different order of starting devilspie and gdevilspie.

However I just pushed a change to handle multiple instances of devilspie started before gdevilspie.

Also, is it possible that you are starting devilspie as a different user ?

Comment by nikolay.kovachev, Mar 24, 2008

No same user for 2 apps. User is "root" if this help.

Comment by pharon, Mar 25, 2008

I will try to test it as root .. why are you running your GUI as root anyway ?

I think I am ready for a bugfix release 0.21 , meanwhile can you please open an issue in the bug tracker and describe the problem you are facing in details, because I still can't reproduce it here.

Thank you so much for your testing :)

Comment by nikolay.kovachev, Mar 25, 2008

Because as root i don't need to enter password so frequently like normal user :). But when Hardy is released i will make normal user on new install.

I make clip for issue: http://www.mediafire.com/?mvtjszyyskw - 300KB

Comment by techhelpbb, Apr 04, 2008

When I attempted to install and use the 0.31 code on Ubuntu 6.06 LTS I got this:

(gdevilspie:9155): libglade-WARNING : unknown property enable_grid_lines' for class GtkTreeView?'

(gdevilspie:9155): libglade-WARNING : unknown property enable_tree_lines' for class GtkTreeView?'

(gdevilspie:9155): libglade-WARNING : unknown property transient_for' for class GtkAboutDialog?'

(gdevilspie:9155): libglade-WARNING : unknown property program_name' for class GtkAboutDialog?' Traceback (most recent call last):

File "/usr/bin/gdevilspie", line 846, in ?
MainWindow? = RulesListWindow?()
File "/usr/bin/gdevilspie", line 355, in init
self.tray = gtk.StatusIcon?()
AttributeError?: 'module' object has no attribute 'StatusIcon?'

It appears to not like the installed PyGtk? but I've got all the versions available in the Synaptics manager installed.

I'm going to try to upgrade to Ubuntu 7.10 and see what happens.

Comment by pharon, Apr 04, 2008

I am afraid the StatusIcon? was introduced in PyGTK-2.10 , and dapper has only PyGTK-2.8.6

If you are still running dapper because it's an LTS , I suggest you try Hardy when it gets released, as it is an LTS as well.

Comment by techhelpbb, Apr 04, 2008

Confirmed, after an upgrade to Ubuntu 7.10 it seems to run fine.

Comment by sindrb, Apr 07, 2008

0.30 release is now packaged and included in Fedora 8 and the upcoming 9 release. Thanks for making systemwide install (and by extension packaging) so easy in this release.

Comment by pharon, Apr 08, 2008

Oh my, that was fast .. Thank you ! Many thanks also to thesamo for working on the system wide install :)

Comment by martin.raissle, May 17, 2008

hi .. starting gdevilspie without installing it does not work, since it's complaining about a missing glade-file / icon .. adding these two lines fixes the problem (though I'm not sure if this is the right way since I've never written python) .. here's the diff

286a287 > elif os.path.isfile('./gdevilspie.glade'):gladefile = './gdevilspie.glade' 296a298 > elif os.path.isfile('./gdevilspie.png'):gdevilspie_icon = './gdevilspie.png'

Comment by pharon, May 18, 2008

Sorry for the late reply , we don't check the wiki comments a lot, but we watch the issue tracker closely. Thanks for taking the time to post the patch, I will look into it as soon as I get some free time.

Comment by andy.rigney, Jun 12, 2008

gdevilspie-0.31 won't run on my Gentoo box running KDE 3.5 in 64-bit (not sure about 32-bit). It just errors out with "Segmentation Fault". The GUI pops up real quick, then goes away and I'm just left with that seg fault error. However, gdevilspie-0.2 works fine. I tried running 'gdevilspie -v' hoping it would print out some more errors, but no dice. Just thought I should make you aware of this.

Comment by theSamo, Jun 14, 2008

please report bugs/problems in the issue tracker instead of here :)

Comment by sunyuxi, Aug 01, 2008

I'm having all kinds of problem on ubuntu8.04 it doesn't seem to be able to control bunch of chromed firefox windows even using separate window_name and all firefox are cluttered in one viewport (since ubuntu8.04 defaults to compiz which doesn't like workspace)... besides, the viewport seems to have nearly no effect in controlling which specific viewport to situate each firefox window...

any idea?

Comment by wmc...@rogers.com, Jan 14, 2009

Is there a mailing list that mainly deals with Devil's Pie questions?

In lieu of that; I have a couple I would like to have clarified.

I have a gdevilspie script, ~/.devilspie/Evolution_ws3.ds, that works fine as far as it goes. I have devilspie set in my sessions manager to start at startup. The script is set to start Evolution on workspace 3 with a certain geometry.

However, I have noticed that Evolution still starts on workspace 1, flashes for a fraction of a second, and is then moved to workspace 3. If this is the way it has to be, I can live with it. But it seems a bit "hacky". Is there a way, or a startup file (eg xresources), that I should use so that the start up feels and looks smoother; so that Evolution just seems to start in workspace 3 with no milli-second flash?

By the way, I have read and explored several good wiki's and tutorials on using devilspie, but either I am blind or they remain silent on this question."

A second question has developed over the week. Which configuration dominates -- the gconf-editor or Devil's pie? It seems I am bouncing between the two in order to get my windows to do what I want.

Regards Bill Fedora 10, Gnome 2.24.2 Evo.2.24.2, Emacs 22.2.1

Re: decoration: msg#00017 window-managers.openbox

Re: decoration: msg#00017 window-managers.openbox


On 06/08/05 08:11:52, Ales Zemene wrote:
hi,
i really like the feature of switching off decoration of the windows,
looking for the way how to switch off deco of ALL windows at the same
time. Or possibly scripting it, or setting in config file.
any ideas ?


#!/bin/sh
for $window in `wmctrl -l | cut -f -d ' '`
do
wmctrl -i -r $window -b toggle,undecorated
done

you'll need the attached wmctrl patch to access the undecorated bit.

-K

Devil's Pie [foosel.(net|org)]

Devil's Pie [foosel.(net|org)]

Devil's Pie

First of all: What is Devil's Pie? From the developer's site:

A window-matching utility, inspired by Sawfish's “Matched Windows” option and the lack of the functionality in Metacity. Metacity lacking window matching is not a bad thing — Metacity is a lean window manager, and window matching does not have to be a window manager task.

Devil's Pie can be configured to detect windows as they are created, and match the window to a set of rules. If the window matches the rules, it can perform a series of actions on that window. For example, I can make all windows created by X-Chat appear on all workspaces, and the main Gkrellm1 window does not appear in the pager or task list.

With the release of version 0.13 the configuration files changed from an xml-based format to s-expressions. This wiki node represents my try at documenting the new format, as sadly there is no official documentation yet. The information I provide here was kinda extracted from the source code of Devil's Pie.

I will give a generic syntax definition for each function, followed by a Java-Representation in order to describe the defined datatypes, using the following conventions:

  • String means a valid string, e.g. “firefox-bin”.
  • int means a valid integer value, e.g. 0 or 800.
  • boolean means a boolean value, either true or false.
  • Object means a mixed type determined at runtime.

There is also a small collection of example rules with a description of what they do.

The current version of this document covers Devil's Pie from 0.13 up to 0.20.2. I do my best to update it as soon as I find time to search the codebase of current versions for changes and describe them.

General format

The configuration files consist of rules formulated in an s-expression based syntax, with ; denoting comment-lines which are not parsed, e.g.

; Move firefox to workspace 2
(if
(is (application_name) "firefox-bin")
(set_workspace 2)
)

Those files have the extension ds and usually are located at ~/.devilspie.

If I say “one rule for each file”, I really mean it: If you add more than one, the others will simply be ignored by Devil's Pie's parser (at least up to version 0.20). So be sure to make a file for each rule you want to define.

What you can do though is encapsulate several rules in one begin block, this works like a charm. Additonally, with version 0.20 Devil's Pie also seems to have support for multiple expressions per file natively, though I haven't tested this yet myself. Whether you want to use this is up to you - I prefer the “one-rule-per-file” variant for the sake of clarity ;-).

Examples

The configuration currently in use on my ThinkPad can be found here.

  • Move Firefox to workspace 2 and maximize it:
    (if
    (is (application_name) "firefox-bin")
    (begin
    (set_workspace 2)
    (maximize)
    )
    )
  • Pin the Gaim Buddylist to all workspaces, with a size of 340×630 pixels and at position (4,150):
    (if
    (and
    (is (application_name) "gaim")
    (is (window_name) "Buddy List")
    )
    (begin
    (pin)
    (geometry "340x630+4+150")
    )
    )
  • Move Skype to workspace 1, set its size to 300×600 pixels, center it, make it “always on top” and let it skip pager and tasklist:
    (if
    (matches (application_name) "^Skype")
    (begin
    (geometry "300x600")
    (center)
    (above)
    (skip_pager)
    (skip_tasklist)
    )
    )
  • Move a gaim window that is neither the buddy list nor an IRC conversation (thanks to Andrew Conkling for this example):
    (if
    (and
    (is (application_name) "gaim")
    (not (is (window_name) "Buddy List"))
    (not (contains (window_name) "#"))
    )
    (geometry "+0+313")
    )
  • Remove the window decoration from all windows:
    (undecorate)
  • Combine two rules into one file:
    (begin
    (if
    (is (application_name) "firefox-bin")
    (begin
    (set_workspace 2)
    (maximize)
    )
    )
    (if
    (and
    (is (application_name) "gaim")
    (not (is (window_name) "Buddy List"))
    (not (contains (window_name) "#"))
    )
    (geometry "+0+313")
    )
    )

Constructs

if

(if a b)

(if a b c)
if (a) {
b;
}

if (a) {
b;
} else {
c;
}

A conditional flow based on the boolen expression a.

Example:

  • (if (is (application_name) “firefox_bin”) (set_workspace 2)) - Moves the window to workspace 2 if the application it belongs to is Firefox.

begin

(begin a b c ...)
{
a;
b;
c;
// ...
}

A sequential execution of actions a, b, c, …

Example:

  • (if (is (application_name) “firefox_bin”) (begin (set_workspace 2) (maximize))) - If the window belongs to the application Firefox, move it to workspace 2 and maximize it.

Boolean Operations

and

(and a b ...)
boolean and(boolean a, boolean b, ...)

Returns the result of and-ing the given logical expressions.

Examples:

  • (and true true) - true
  • (and true false) - false
  • (and false false) - false
  • (and true true true) - true
  • (and true false true) - false

or

(or a b ...)
boolean or(boolean a, boolean b, ...)

Returns the result of or-ing the given logical expressions.

Examples:

  • (or true true) - true
  • (or true false) - true
  • (or false false) - false
  • (or false false false) - false
  • (or false false true) - true

not

(not a)
boolean not(boolean a)

Returns the negation of the given logical expression a.

Examples:

  • (not true) - false
  • (not false) - true

String Tests

is

(is a b)
boolean is(String a, String b)

Returns true if a and b are the same.

Examples:

  • (is “foo” “foo”) - true
  • (is “foo” “bar”) - false

contains

(contains haystack needle)
boolean contains(String haystack, String needle)

Returns true if needle is a sub-string of haystack.

Examples:

  • (contains “somefoobar” “foo”) - true
  • (contains “somefoobar” “fnord”) - false

matches

(matches str pattern)
boolean matches(String str, String pattern)

Returns true if pattern matches on string. pattern is a Regular Expression.

Examples:

  • (matches “foobar” ”[o]{2}b”) - true
  • (matches “foobar” ”[0-9]+”) - false

Matchers

Matchers return certain properties of the available windows – like windowtitle, applicationame, … – and are used to formulate conditions to match certain programs and/or windows.

window_name

(window_name)
String window_name()

Returns a STRING containing the name of the window as displayed in the windows titlebar.

window_role

(window_role)
String window_role()

Returns a STRING describing the current window role of the matched window as defined by it's WM_WINDOW_ROLE hint.

application_name

(application_name)
String application_name()

Returns a STRING containing the name of a windows application.

window_workspace

(window_workspace)
int window_workspace()

Returns an INT containing the number of a windows workspace aka virtual desktop.

window_class

(window_class)
String window_class()

Returns a STRING containing the class of a window.

window_xid

(window_xid)
int window_xid()

Returns an INT containing the XID of a window.

window_property

(window_property propertyname)
String window_property(String propertyname)

Returns a STRING containing the value of the requested property of a window. See the "Application Window Properties" part of the "Extended Window Manager Hints" specification for a list of possible window properties to request.

Actions

One or more of the following actions can be applied to a set of selected windows, which can be either a subset of all windows on the screen (created by using a single matcher or a combination of matchers and the if statement) or simply all windows.

debug

(debug)
void debug()

Prints information to stdout about matched open windows, including applicationname, windowtitle, windowrole and geometry.

print

(print text)
void print(String text)

Prints the String text to stdout (without a newline at the end), useful for debugging purposes.

println

(println text)
void println(String text)

Prints the String text to stdout (with a newline at the end), useful for debugging purposes.

str

(str value)
String str(Object value)

Converts given value into a String and returns it. The value can be boolean, int, a String, an array pointer or even a timestamp which is then formatted into a date respresentation as defined by the current locale.

hex

(hex num)
String hex(int value)

Converts given value into a String containing the value's hexadecimal representation (including a 0x at it's beginning).

geometry

(geometry geo)
void geometry(String geo)

Sets the geometry of the matched window. geo must be a STRING containing a valid X-GeometryString as parsed by XParseGeometry. Excerpt from man XParseGeometry:

By convention, X applications use a standard string to indicate window
size and placement. XParseGeometry makes it easier to conform to this
standard because it allows you to parse the standard window geometry.
Specifically, this function lets you parse strings of the form:

[=][{xX}][{+-}{+-}]

Examples:

  • (geometry “400×300+0-22”)
  • (geometry “640×480”)
  • (geometry ”+10+10”)
A friendly hint from the comments, courtesy of Kai-Martin Knaak:

Dialogs and splashscreens don’t accept position and size commands. They have to be turned into normal windows with the wintype command before devilspie can direct them to some other place.

fullscreen

(fullscreen)
void fullscreen()

Sets the matched window into fullscreen mode.

focus

(focus)
void focus()

Gives focus to the matched window.

center

(center)
void center()

Centers the matched window on the screen.

maximize

(maximize)
void maximize()

Maximizes the matched window horizontally and vertically.

maximize_vertically

(maximze_vertically)
void maximize_vertically()

Maximizes the matched window vertically.

maximize_horizontally

(maximize_horizontally)
void maximize_horizontally()

Maximizes the matched window horizontally.

unmaximize

(unmaximize)
void unmaximize()

Unmaximizes the matched window horizontally.

minimize

(minimize)
void minimize()

Minimizes the matched window.

unminimize

(unminimize)
void unminimize()

Unminimizes the matched window.

shade

(shade)
void shade()

Shades aka “rolls up” the matched window.

unshade

(unshade)
void unshade()

Unshades aka “rolls down” the matched window.

close

(close)
void close()

Closes the matched window.

pin

(pin)
void pin()

Pins the matched window, making it visible on all workspaces.

unpin

(unpin)
void unpin()

Unpins the matched window.

stick

(stick)
void stick()

Sticks the matched window, making it visible on all viewports.

unstick

(unstick)
void unstick()

Unsticks the matched window.

set_workspace

(set_workspace num)
void set_workspace(int num)

Moves the matched window to workspace number num (counting from 1).

Example:

  • (set_workspace 1)

set_viewport

(set_viewport num)
void set_viewport(int num)

Moves the matched window to viewport number num (counting from 1).

Example:

  • (set_viewport 2)

skip_pager

(skip_pager)
void skip_pager()

Stops the matched window from being shown in the pager.

skip_tasklist

(skip_tasklist)
void skip_tasklist()

Stops the matched window from being shown in the tasklist.

above

(above)
void above()

Makes the matched window be always on top.

below

(below)
void below()

Makes the matched window stay under all other windows.

undecorate

(undecorate)
void undecorate()

Removes the window manager decoration from the matched window.

wintype

(wintype type)
void wintype(String type)

Sets the window type of the matched window. type can be one of the following values: “normal”, “dialog”, “menu”, “toolbar”, “splashscreen”, “utility”, “dock”, “desktop”.

See the _NET_WM_WINDOW_TYPE part of the "Extended Window Manager Hints" specification for more details on what exactly this can do.1)

Examples:

  • (wintype “normal”)
  • (wintype “toolbar”)

opacity

(opacity percent)
boolean opacity(int percent)

Sets the opacity of the matched window to the given percentage. Returns true upon success.

spawn_sync

(spawn_sync command)
(spawn_sync command1 command2 ...)
String spawn_sync(String command)
String spawn_sync(String[] command)

Executes the given command (given as either one String or a list of multiple Strings) in the foreground and returns its output as a String.

spawn_async

(spawn_async command)
(spawn_async command1 command2 ...)
boolean spawn_async(String command)
boolean spawn_async(String[] command)

Executes the given command (given as either one String or a list of multiple Strings) in the background and returns true upon successful command start.

See also

1) Big thanks go out to Lenix, who provided me with above link and explained the whole windowtype thing to me :-)

Discussion

Andrew ConklingAndrew Conkling, 2006/01/26 05:49

First of all, thanks for such clear and comprehensive documentation. Let’s hope this makes it into devilspie.

I was just wondering if it were possible to create a “not” condition, e.g.: (is (application_name) “gaim”) (is not (window_name) “Buddy List”) (contains not (window_name) “#”) The goal is to match a Gaim conversation window that’s not the buddy list or an IRC chat window.

Gina HaeussgeGina Haeussge, 2006/01/26 16:30

Sadly, such a construct doesn’t seem to be implemented in the s-expression engine devilspie uses. In theory, it should be possible to write an s-expression emulating a not by simply putting the action to perform into the else arm of the if construct and just some empty statement in the other: (if (is (window_title) “Buddy List”) (+ 1 1) (pin)). This seems to work with one tier, but when I just tried to extend this to two tiers (by encapsulating the above construct with an addition (if (is (application_name) “gaim”) (...))) it didn’t execute the pin action, although the debug action worked (and printed information only about the chat-window, not the buddylist, so it matched correctly). I don’t understand this behaviour though. The best thing would probably be to extend src/s-expr.c to allow a not statement, which shouldn’t be too difficult. Maybe write a nice email to Ross that he adds it :-)

I have to correct myself here: There is a not statement (should have used grep earlier *cough*), will update the documentation shortly.

Andrew ConklingAndrew Conkling, 2006/01/27 18:05

Very nice, thanks for updating. I got it working, but not that way. Here’s what I ended up with:

(if
(and
(is (application_name) "gaim")
(not (is (window_name) "Buddy List"))
(not (contains (window_name) "#"))
)
(begin
(geometry "+0+313")
)
)

Also, is it possible to do something with the main Firefox window, but leave any secondary windows (dialogs, popups, etc.) alone? I can’t figure any way to match just the main window.

Gina HaeussgeGina Haeussge, 2006/01/28 12:25

I can’t find one either. Sadly, Firefox doesn’t set any window role hints, at least devilspie doesn’t detect them, otherwise one could have depended on those to match.

matomato, 2006/02/05 22:06

hi, i’m thinking of this – i’d like some windows that suddenly spring open not to steal focus (that is not to get focused). but i can’t see unfocus among the actions. how could i achieve it pls? cheers, m.

Andrew ConklingAndrew Conkling, 2006/02/07 17:35

mato, I think that kind of functionality exists in different window managers. Maybe seek out some other ones?

Gina HaeussgeGina Haeussge, 2006/02/08 10:45

XFCE for example - smaller, better, faster ;)

Anyway, if I needed to implement an unfocus action, I’d try to make devilspie track the focused windows, keeping in mind the currently and priorily focused one and then refocusing the priorily one if the current one matches an unfocus action. But I’m not sure whether it is possible to track the current focus (sadly I have no experience at all at X11 programming), but if someone sees the need for implementing such a functionality althouh a window manager can already provide it, go ahead ;)

JohnyJohny, 2006/02/22 19:48

Hi, thanks for this great reference, it helped me finally understand the new system.

However, there are few things that need to be corrected:

1. (print “something”) action – that’s pretty obvious. Prints the string parameter to stdout (like debug). For example, (begin (print “You have opened: “) (print (window_name)) ) will print the exact name of the window that has been matched.

2. (below) action is not the opposite state of (above), as your comment might suggest. There are actually three states – above, below and normal (no action used). Your description for above is correct, but your description for below belongs to normal. Below means that the window will _always_ be at the bottom, no matter if it has been clicked, has focus, whatever.

Gina HaeussgeGina Haeussge, 2006/02/23 12:34

Thanks for the additions and corrections, I included them in the text.

RichRich, 2006/02/24 17:50

Back to the focus issue. I as well would like to only have one window always have focus and have made appropriate .ds files. However I get a timestamp 0 error and it never gets focused. It has been suggested that I can force the use of timestamps but have not seen any reference to any forcing or timestamps. Anyone care to clear this up? An example perhaps? Please :)

Michael O'Dell IIMichael O'Dell II, 2006/03/02 04:02

I may have found a way to do as requested by Andrew regarding Firefox; do something to the main window without affecting other windows. I assume this means without multiple browser windows open. I don’t need this functionality, and thus haven’t tested it, but it seems like it should work. Also, I don’t expect it to work with the Titlebar Tweaks extension for Firefox. Here it is:

; Move the Firefox browser window to workspace 2 and maximize it. (if (and (matches (application-name) “^firefox-bin$”) (matches (window-name) “^.*-.Mozilla.Firefox$”) ) (begin (set_workspace 2) (maximize) ) )

Michael O'Dell IIMichael O'Dell II, 2006/03/02 04:06

Bah. Stupid parsing. Let’s try this again:

; Move the Firefox brwoser window to workspace 2 and maximize it.
(if
(and
(matches (application-name) "^firefox-bin$")
(matches (window-name) "^.*-.Mozilla.Firefox$")
)
(begin
(set_workspace 2)
(maximize)
)
)
Filippo RusconiFilippo Rusconi, 2006/03/09 18:55

Only to thank you very very much for one so helpful page. Sincerely,

Filippo Rusconi

Kai-Martin KnaakKai-Martin Knaak, 2006/05/11 17:48

It took me quite some time to realize that devilspie stops parsing an *.ds file after the (debug) statement. Also, it is by far not obvious that devilspie will take only the first statement of every file and ignores the rest. This is not only contrary to the behaviour of the previous versions but also highly unusual. You may add both snippets of information in large and friendly letters at the appropiate places of the wiki.

Thank you for providing the information, the author of the tool didn’t bother to put into the docs. —<(kaimartin)>—

Kai-Martin KnaakKai-Martin Knaak, 2006/05/11 23:54

Sorry for posting the above comments twice. Can you remove one of them? Thank you.

Yet another gotcha that may go into the tutorial: Dialogs and splashscreens don’t accept position and size commands. They have to be turned into normal windows with the wintype command before devilspie can direct them to some other place. —<(kaimartin)>—

ZenoZeno, 2006/05/12 09:29

i was searching how to undecorate every windows on all my workspaces...something like this:

(if (is (application_name) “*”) (undecorate))

or around this solution...but I haven’t found nothing that work!

Currently, I’ve solved this problem using this method:

(if (matches “str” “str”) (undecorate))

but isn’t logical and I don’t like it.

Someone knows something about this? Thanks a lot.

Gina HaeussgeGina Haeussge, 2006/05/12 11:57

@Kai-Martin

Thanks for your additions! I will incorporate them ASAP.

About the debug thing though, I would be grateful if you could provide an example rule that shows that behaviour. I just tried to reproduce it, but couldn’t bring devilspie to ignore the rest of my test rule.

@Zeno

A simple (undecorate) already should do the trick. Just put it in a .ds file in ~/.devilspie.

Gina HaeussgeGina Haeussge, 2006/05/12 12:11

Update

I just realised I haven’t been very clear on the usage of actions, as it sounded like you needed to select a subset of windows first with some matchers. I rewrote that accordingly to reflect reality a bit better ;-)

Kai-Martin KnaakKai-Martin Knaak, 2006/05/12 16:50

I see, that my comments already made it into the text :-) Maybe I wasn’t clear about the debug thing. I missunderstood the debug rule as an option and placed it in the beginning of a *.ds file. Devilspie reads it as the first S-expression and does not read any further. This is of course a consequence of devilspie current (miss-) behaviour to parse the first expression only. It would be nice, if the tutorial would recommand to put the (debug) statement in a seperate file, or inside the action section of a rule.

This is the *.ds file that is read only until the end of the debug statement.

 (debug)
(if
(is (window_name) "Transformation")
(begin
(geometry "+1000+400")
)
)
Gina HaeussgeGina Haeussge, 2006/05/12 23:58

Yeah, I was trying to chicken out of learning for uni this morning and updating the wiki came as a handy excuse to do so :-D

Anyway, now I get the problem with the debug statement... I will add a small word of warning somewhere :-)

Kai-Martin KnaakKai-Martin Knaak, 2006/05/15 04:35

Hi again, I just discovered that it is possible to keep all rules in one file: Just put them inside the parenthesis of a “(begin foo)” statement. Pretty obvious with hindsight... Example: (begin

(if (is (window_name) "Selection")
(begin
(wintype "normal")
(geometry "+1100+130")
(print "Edit2DProfile")
)
)

(if (is (window_name) "3D Snap")
(begin
(wintype "normal")
(geometry "+1100+130")
(print "3D Snap")
)
)
)
Gina HaeussgeGina Haeussge, 2006/05/15 09:56

Thanks again, just incorporated that piece of info as well :)

Joseph Le-PhanJoseph Le-Phan, 2006/06/15 19:25

@Gina Thanks for the terrific write-up! :)

@Contributers Thanks for the ideas :D

I have a question regarding DP. I haven’t had the chance to look at the code, but is there a way to set display (in a multi-display setup) for windows?

Gina HaeussgeGina Haeussge, 2006/06/15 23:44

I haven’t encountered something like this as of now during my code studies, but it would be a great addition IMO :D

TLETLE, 2006/06/18 13:59

I’ll second that (Gina Haeussge). Can any of you confirm for sure that it isn’t possible to use it to change display (I’m not THAT good at reading code), becuase I’ve seen a lot of threads in the Ubuntu forums, where people ask if it is possible to control window behavior across dual displays in a Xinerama configuration, and all the time, the question is answered with something like “I don’t know if it’ll work but you could try to use Devil’s pie”. So it would be nice to know for sure if that isn’t possible so we can look for another solution, (or hope that it’ll be included in Devil’s pie at some point;) ).

Brian K.Brian K., 2006/06/20 00:15

I would like for my terminal (in Gnome) to open fullscreen everytime. So I made the following terminal.ds file:

(if
(matches (application_name) "me@machine")

(maximize)
)

‘me@machine’ corresponds to the display on top of my terminal window.

So I put the devilspie command in my session startup programs, and it doesnt do anything. If I open a terminal window, and type ‘devilspie’ it will maximize that single session only, and concurrent sessions will not maximize unless I specifically type devilspie each time. Is there a way to have devilspie constantly running in the background and automatically maximize each terminal window as it is opened? Thanks for the help.

Gina HaeussgeGina Haeussge, 2006/06/21 10:57

Try putting devilspie & instead of devilspie in your startup file. I simply put that line in my .xsession, works flawlessly.

Mike BreytenbachMike Breytenbach, 2006/07/18 00:08

Great guide. Was this written by a woman?

Gina HaeussgeGina Haeussge, 2006/07/18 11:22

Actually yes... dunno though why this would matter ;)

Mike BreytenbachMike Breytenbach, 2006/07/19 15:54

Doesn’t matter at all. I could just tell ;)

Kai-Martin KnaakKai-Martin Knaak, 2006/08/05 15:17

Just discovered the ability to match the the window class. Works great for editors like LyX. You might add “window_class” to the list of matchers. —<(kaimartin)>—

Ciprian PopoviciCiprian Popovici, 2006/09/08 22:27

Is it possible to clear a flag, such as skip_pager or skip_tasklist? And why is it even called skip_tasklist, I thought it was supposed to be skip_taskbar?

saikosaiko, 2006/09/26 15:54

Hello, I’m using Ubuntu 6.06 LTS with the latest updates and GNOME with MetaCity, though I can’t get Devil’s Pie to get running properly on my system. For example “application_name” doesn’t seem to work for me at all. Also, (if (is (window_name) “Terminal”) (geometry “640×500+100+100”)) X and Y position has no effect whatever numbers i put here, what could be the problem? I store my *.ds files in ~./devilspie Thanks in advance.

Einarin polkupyöräEinarin polkupyörä, 2008/03/04 18:36

I have the same problem with Ubuntu 7.10 and devilspie 0.22

Gina HaeussgeGina Haeussge, 2006/09/26 19:39

@Ciprian Popovici: First of all sorry for the late answer, I just now saw this. About an undo action for skip_pager or skip_tasklist - I didn’t find one in the source. The used library would allow one, the developer didn’t include one though as to my knowledge, although I have no idea why he did skip to implement this...

@saiko: Maybe someone reading this here might be able to help you with this problem, as I’m using neither Ubuntu nor Gnome I sadly can’t.

But just to clearify again, I am not the developer of Devil’s Pie. I’m just a user of it as well, I just found the total lack of documentation for the tool intolerable and therefore wrote one by reading the sourcecode of the tool. So any bugs, naming concerns or whatever are nothing I can do anything about, you should post them in the official bugtracker of Devil’s Pie.

JulianJulian, 2006/10/16 19:43

May be more or less usefull, but I made a VIM syntax file. It’s a first try and not very complex/solid in its design but it works. Please have a look, http://wiki.goatpron.de/linux/vim/syntax/devilspie

Jon WilsonJon Wilson, 2007/06/30 17:19

You might instead try looking at the already existing vim syntax file for scheme or for common lisp. Formatting s-exps is a solved problem, so we might as well just reuse what’s already been done. I usually edit the files with a .scm extension, and then rename them to have the .ds extension when I’m done. It would probably be fairly simple to change the syntax files to recognize .ds as a scheme (or common lisp) file.

Piotr SmyrakPiotr Smyrak, 2007/09/07 11:32

Such an addition into .vimrc should be enough:

au BufNewFile,BufRead *.ds :set syn=scheme
Mike GrabowskiMike Grabowski, 2006/11/15 04:06

Ok, I have devilspie installed and set to run upon login via sessions. The sample gaim rule that pins the conversations windows to each workspace appears to work just fine. Now, any and all Firefox rules I’ve tried to implement will not work for me upon login, but will work if I open a terminal and type ‘devilspie -a’. This is very confusing and any help would be greatly appreciated in making these Firefox rules work upon login along with the gaim rules.

Thanks, Mike

Mike GrabowskiMike Grabowski, 2006/11/15 11:06

Ok, so now it seems to suddenly be working correctly. I have no idea why, maybe all we both needed was a good night of rest. My Firefox is now positioned correctly, but, the dialogs are taking on the same position and size as my main Firefox window. Does anyone know how to ignore dialog boxes? Such as the warning for closing multiple tabs or the preferences dialog.

Thanks again, Mike

Gina HaeussgeGina Haeussge, 2006/11/16 21:04

Hm.. could you please paste the rule you used to match Firefox? Maybe that would give a hint as to why it is behaving like you said.

BobBob, 2006/12/02 15:44

devilspie really is great and works fine for me, except...

problem with Radrails: But I can’t get a program called Radrails (IDE for Rails) to go to a specific workspace. Do you’ve any suggestions?

my radrails.ds file in $HOME/.devilspie:

(if (is (application_name) “radrails”) (set_workspace 2))

Cord KaldemeyerCord Kaldemeyer, 2006/12/12 20:03

What output does the debug.ds create? Is it really the correct appname?

Ammar AijaziAmmar Aijazi, 2006/12/16 18:42

Well, after spending about an hour on this, I cannot get it to properly configure GIMP. For the image window, I have:

(if (is (window_role) “gimp-image-window”) (begin geometry “732×689+292+73”(set_workspace 4)))

This works perfectly, opening up any image window in the fourth desktop and resizing it properly. Unfortunately, I cannot get the toolbox window to send itself to another desktop with any consistency, it is just strange. Its properties, as far as I can tell are:

Window role : “gimp-toolbox” Window name : “The GIMP” Window class: “gimp” Application name: “gimp”

All I want is for it to open up on the fourth workspace whenever I launch it. I have tries lots of variations of:

(if (is (window_role) “gimp-toolbox”) (begin (set_workspace 4)))

Now, if run it and just wait, it will open itself on the current desktop. However, if make GIMP’s splash screen lose focus (by clicking into another window), it will send itself to another desktop. Why does it do that? Has anybody had any success in configuring GIMP? Also, setting its geometry always works fine, it’s just sending it to another workspace that it has troubles with,

SiriusSirius, 2006/12/25 00:28

Hey Ammar (and everyone else of course), I’ve managed to customize GIMP to move to another workspace this way:

(or

(matches (window_role) "^gimp.*$")
(is (window_name) "The GIMP")

)

This matches the splash-screen, the toolbox, the main window and the opened image window. So you could first modify each window individually and then move them all to wherever you want.

DarkJesusDarkJesus, 2007/01/03 02:34

I’m having some trouble finding out the application name. Using just “gaim” and “xchat” for those two work, but I’m having some problems with swiftfox. I’ve tried a few combinations (”swiftfox-bin”, “/usr/lib/swiftfox-bin”, “swiftfox”, etc.) but devilspie doesn’t seem to recognise any of them. Is there a way I could find out the exact application_name I should be using?

Gina HaeussgeGina Haeussge, 2007/01/04 19:51

Create a file, just containing the debug action, start up devilspie, then start swiftfox, and take a look what the debug output states about your window. Alternatively try using xprop.

Andrew YatesAndrew Yates, 2007/01/29 21:25

Someone with write access should add the window_workspace matcher, which returns the number of the window’s workspace/virtual desktop.

Gina HaeussgeGina Haeussge, 2007/01/29 23:08

Done.

MonsieurBonMonsieurBon, 2007/02/07 20:39

Hello! I’m trying to display the same terminal window on each of the four desktops. Does anyone know how to do that?

MonsieurBonMonsieurBon, 2007/02/07 23:15

Ok, I got that with pin. Now there’s one other thing. If I say (wintype “desktop”) it really shows on the desktop, but disappears when i click on anything else on the desktop. How do I get it NOT to hide when I click on the desktop? The code I use:

(if

(is (application_name) "Terminal")
(begin
(pin)
(undecorate)
(geometry "+382+333")
(wintype "desktop")
)

)

RateLRateL, 2008/04/30 13:39

did you get it working ? I might be wrong, but even with the (above) option setting wintype to “desktop” is useless, because whe I unfocus the window it disappears and cannot be restored (at least with a mouse click).

RobRob, 2007/03/03 00:45

I want to close window matching criteria A if window matching criteria B is open. Can I do this with devilspie?

Kai HoernerKai Hoerner, 2007/03/13 10:54

This way I pin a borderless terminal window (Eterm) onto the Desktop. Using “wintype dock” it does not hide when you click the desktop or use the “show desktop” feature of your window manager. “below” is necessary, because the window would else be on top of all other windows. this way (”wintype dock” + “below”) makes the window be on top of the desktop window, but below all other windows.

(if

   (and
(matches (application_name) "^rootterm")
(matches (window_class) "^Eterm")
)
(begin
(undecorate)
(skip_tasklist)
(skip_pager)
(pin)
(wintype "dock")
(below)

) )

I start my Eterm like this:

Eterm -x -O -q –cmod 128 -g 140×17+10-35 -T rootterm –no-cursor –buttonbar=no –scrollbar=no -e tail -f /var/log/screenmessages

Explanation of the Eterm Parameters: * -x : Borderless * -O : Transparency * –cmod 128 : shade by 50% * -g : geometry (devilspie is not reliable) * -T : set window title, needed for match with devilspie * -q : do not accept input, output only * –no-cursor : no input cursor, output only * –scrollbars=no : self explaining * –buttonbar=no : same here * -e : execute command

ViernesViernes, 2007/05/30 17:22

Hi Kai Hoerner

I’ve used your solution without -q and -no-cursor option to try to get a desktop terminal that doesn’t hide with “show desktop”. It works, but when I lose the focus on it, I couldn’t never get it focused again to write to it.

(Well, if I press “Crtl+Alt+Tab” I can switch to it, but it is not desirable). Is there any way to regain focus on the terminal by using mouse button??? or even by pressing the “show desktop” button????

Does anybody have any idea???

Thanks

canaharicanahari, 2008/12/20 09:55

Hello!

I've just experienced the same thing about losing focus and never getting it back. Has anyone found a solution for this problem yet?

Thanks, Eszter

Donald JohnstonDonald Johnston, 2007/03/24 03:01

I am working the same situation as Mike Grabowski’s post of 2006/11/15 11:06 (don’t see a resolution posted). Am able to control the main Foxfire screen, but ‘Add Bookmark’ opens in the same size as the main window regardless of the size specified in the rule.

Firefox rule...firefox.ds (if

(and
(is (application_name) 'Firefox')
(begin
(geometry '1080x821+350+49')
)
)

)

Firefox ‘Add Bookmark’ rule...bookmark.ds (if

(and
(is (window_name) 'Add Bookmark')
(is (application_name) 'Firefox')
(begin
(geometry '540x410+350+49')
)
)

)

Gina HaeussgeGina Haeussge, 2007/03/24 10:31

Hm... I can’t try this out myself right now, but you might have success in stopping the bookmark dialog to be matched by using something like

(if
(and
(is (application_name) "Firefox")
(not (is (window_name) "Add Bookmark"))
)
(geometry "1080x821+350+49")
)

Alternatively, you might have success by juggling around with the window_role matcher. A debug rule could help here to find out what roles firefox sets on its windows.

Donald JohnstonDonald Johnston, 2007/03/31 15:28

I might be a bit dense, but if I work at it long enough, sometimes I see the light. I have resolved the problem I was having with the Firefox ‘Add Bookmark’ window also opening at the same size as that set for the main FF window by using:

(if

(is (window_name) 'Add Bookmark')
(begin
(geometry '540x150+150+350')
)

)

Didn’t really need the application_name in the rule. Of course, if some other app has an ‘Add Bookmark’ window, it will respond to the above rule.

Another thing that was causing me to get screwed up was the use of ‘devilspie -d &’ in a terminal window to check my results. I hadn’t realized that each time I did that, I was launching an additional job. Nothing like having a dozen versions of devilspie runnng at the same time. Use the ‘kill’ command.

Jørn ChristensenJørn Christensen, 2007/04/03 13:10

Hi,

If you are using Compiz, it will not accept set_workspace (at least I got the message workspace does not exist). Instead use set_viewport. This should probably also be added above...

~Jørn

Gina HaeussgeGina Haeussge, 2007/04/03 14:20

I finally had the time to update this to cover Devil’s Pie 0.20.2 and hopefully found all changes in available matchers and actions. Enjoy.

Dou KayaDou Kaya, 2007/04/22 00:09

With the addition of spawn_sync, some processing can be done in externally, and the workspace that we want the window to switch to, for example, can be calculated, as opposed to being put in the .ds file as a constant. However, spawn_sync returns a string, and as far as I could tell, there is no way of converting a string type into an integer type (atoi) in the given codebase (although the reverse is possible). Because of this I made a tiny addition to the code, so that set_workspace does not reject a string if it is convertable to a non-zero integer. A better solution would be to add atoi as an action, but I didn’t have the time or the guts to add a new action to the code - slightly changing an existing action is obviously a lot easier and safer.

Gina, I know you are not the developer, but you do provide a lot more documentation than the developer. Therefore, in case anybody else wants to use it, I am attaching my small patch here:

diff -Naur devilspie-0.20.2/src/actions.c devilspie-0.20.2_new/src/actions.c
--- devilspie-0.20.2/src/actions.c 2007-01-08 14:22:52.000000000 -0500
+++ devilspie-0.20.2_new/src/actions.c 2007-04-21 17:55:53.000000000 -0400
@@ -27,6 +27,7 @@
#include "xutils.h"
#include "devilspie.h"
#include "actions.h"
+#include "stdlib.h"

/*
* Actions to perform on windows.
@@ -419,12 +420,25 @@
WnckWorkspace *workspace;
int num;

- if (argc != 1 || argv[0]->type != ESEXP_RES_INT) {
- g_printerr(_("set_workspace expects a single integer argument\n"));
+ if (argc != 1 ){
+ g_printerr(_("set_workspace expects a single argument\n"));
return e_sexp_result_new_bool (f, FALSE);
}

- num = argv[0]->value.number;
+ switch(argv[0]->type){
+ case ESEXP_RES_INT:
+ num = argv[0]->value.number;
+ break;
+ case ESEXP_RES_STRING:
+ num = atoi(argv[0]->value.string);
+ if(num != 0)
+ break;
+ // if the string was not a legitimate number,
+ // the default case will be followed
+ default:
+ g_printerr(_("set_workspace expects an integer or its string representation\n"));
+ return e_sexp_result_new_bool (f, FALSE);
+ }

screen = wnck_window_get_screen(c->window);
/* Adjust for 0-offset in workspaces list */
Dou KayaDou Kaya, 2007/04/22 00:17

That didn’t work too well; sorry about that. You can find the patch here: http://www.andrew.cmu.edu/user/odk/devilspie_patch

Gina HaeussgeGina Haeussge, 2007/04/22 00:59

I hope you don’t mind I took the liberty to fix your original patch-post :-)

Dou KayaDou Kaya, 2007/04/22 02:33

No, I don’t mind at all; but actually, forget it. I just realized that there is a way to cast a string into an int, which is only documented in the source and in http://bugzilla.gnome.org/show_bug.cgi?id=423570

Therefore, my patch and comments are entirely useless. You can get rid of them altogether.

It would be really nice, though, if you could also include the symbols in the bug report when you have the time. By the way, thank you for your effort at documenting this, it has helped me a whole lot.

Alex PetersAlex Peters, 2007/05/06 02:30

Fantastic documentation for a fantastic tool. Thanks very much for your efforts!

I have found that (and) accepts more than two expressions, and I suspect that (or) might be the same. Also, it has been implicitly mentioned in the comments that a semicolon can be used at the beginning of a line to denote a comment. It could be useful to incorporate these pieces of information into the main document.

Finally, if anyone is wondering whether the same sort of functionality is available for Microsoft Windows, check out the free PowerPro.

Gina HaeussgeGina Haeussge, 2007/05/06 11:20

You are right, both and and or accept a list of boolean values, at least according to source. I incorporated this information into the documentation, as well as the info about comments. Thanks for the hints :-)

why captcha not workwhy captcha not work, 2007/05/10 01:23

there is no pause or sleep command. i seem to have a race condition for the kgs go server new game window. sometimes the script works and sometimes not.

Nathan DoveNathan Dove, 2007/08/17 20:37

I ran into the same problem, and resolved by spawn_sync-ing sleep before the desired actions:

(spawn_sync "sleep 0.1")
Kyle MitchellKyle Mitchell, 2007/05/19 03:02

Could someone help me figure out how to force windows to never open in a maximized state?

GongoGongo, 2007/05/20 20:41

note: looks like the post didn’t format properly, here’s a second try, please delete my first post.

Kyle: just make a rule with (unmaximize) in it, and nothing else, so it will apply to all windows.

i just wanted to thank you guys for the excellent information, by combining devilspie with wmctrl, i’ve been able to create a rule that simulates the Quake-style drop-down console by using gnome-terminal. i know that there are terminal emulators that do this already (tilda, kuake, yakuake) but none of them seem to be reliable enough, they’re pretty buggy and slow.

anyway, here’s my rule, in case anyone was curious:

; ~/.devilspie/DropDownTerminal.ds
; Sets up a Gnome-Terminal to drop down like a Quake-style Console

(if
(and
(is (window_class) "Gnome-terminal")
(contains (window_name) "DropTerminal")
)
(begin
(wintype "dock")
(geometry "1280x344+200+28")
(wintype "normal")
(skip_tasklist)
(skip_pager)
(above)
(pin)
(stick)
)
)

(if
(and
(is (window_class) "Gnome-terminal")
(is (window_name) "DropTerminal-Down")
)
(begin
(wintype "dock")
(geometry "+200+20")
(wintype "normal")
(shade)
(opacity 0)
(spawn_sync "wmctrl -Fr 'DropTerminal-Down' -T 'DropTerminal-Up'")
)
)

(if
(and
(is (window_class) "Gnome-terminal")
(is (window_name) "DropTerminal-Up")
)
(begin
(opacity 100)
(spawn_sync "wmctrl -Fa 'DropTerminal-Up'")
(spawn_sync "wmctrl -Fr 'DropTerminal-Up' -T 'DropTerminal-Down'")
)
)

i’m also using the following script bound to a key using compiz’s run_command_#, and run_command_#_key to execute it:

#!/bin/bash
#
# ~/.scripts/dropdownterminal.sh
# restarts devilspie for terminal drop down effect

# check that terminal is running
if [ $((`wmctrl -l | grep -c "[[:space:]]asus-z71v\.site[[:space:]]DropTerminal-\(Up\|Down\)"`)) = "0" ]; then
gnome-terminal --window-with-profile="DropTerminal-Down" --hide-menubar &
fi

# restart devilspie
killall devilspie
devilspie -a &
Gina HaeussgeGina Haeussge, 2007/05/21 09:05

I corrected the formatting, hope that’s ok with you :)

Kyle MitchellKyle Mitchell, 2007/05/21 07:08

Gongo: Thanks very much! I guess I was just trying to make things too complicated.

Paolo SantosPaolo Santos, 2007/05/23 17:05

Hi everyone! Before posing my specific question, let me thank you all for the great job on documenting this app.

My problem/unsolved issue is the following. I use Mathematica all the time, and it has various (4 at least) palettes (like those of gimp) which I use. Up to now, every time I start a Mathematica session I had to arrange all those windows one by one, by hand.

Thanks to you I discovered devilspie and decided to ‘automatize’ the placement of these ‘palette’ windows. After reading your info/doc and playing for a while I managed to match each one, and move them to a specific workspace.

However, when I try to assign them a specific geometry (i.e., size and placement) some strange behaviour takes place. If i start devilspie, and after that I start Mathematica, all the windows are moved to the designated workspace but are not placed correctly. On the contrary, if I start Mathematica and then start devilspie with the ‘-a’ command-line option, the windows get correctly arranged. (This tells me that there’s no bug or coding error in my .ds file.)

So... I hope someone could help me with this, I can’t explain myself this... FYI: I use XFCE, (X)Ubuntu Feisty Fawn.

Thanks in advance for all your help!

Paolo

Kai-Martin KnaakKai-Martin Knaak, 2007/06/19 19:01

Hi. There is a typo in the example for maximize_vertically — an i is missing.

—<(kaimartin)>—

Ilya IvanchenkoIlya Ivanchenko, 2007/08/02 10:14

Is there any progress or more info on Xinerama support? Such nice utility as DevilsPie becomes almost completely useless with dual-monitor setup. Now, when nvidia drivers support on-the-fly change of geometry, hard-coded geometry will not work for positioning windows on main monitor. What a pity!

John PielJohn Piel, 2007/09/09 06:04

example of spawn_async use: (if

(matches (window_class) "URxvt")
(begin
(spawn_async (str "transset-df -i " (window_xid) " .82" ) )
)

)

V.V., 2007/09/17 17:12

I have (if

(is (window_class) "Gimp-2.4")
(begin
(set_workspace 2)
)

) for Gimp, but in XFce the main window stays on actual workspace (all other windows go to 2). In Openbox it works fine. What should be wrong?

peter rootspeter roots, 2007/10/03 11:53

Hi - thanks all for some great tips, they got me working as I wanted. Only problem is I can't get devilspie to start when the computer starts! I'm using Kubuntu and tried a shell script in ~/.kde/autostart containing just the line devilspie didn't work so added devilspie to the /etc/rc.local I suspect the problem is a timestamp error i get if I run devilspie from a terminal session - it just sits there with the error and does not return to the prompt. Me thinks if this happens in the autostart or rc.local script I'm scuppered! Any ideas what causes this error and how to get round it my ds file contains the following in case its relevant (if

(is (application_name)"oklin")
(begin
(wintype "normal")
(pin)
(focus)
(above)
)

)

Thanks

Gina HaeussgeGina Haeussge, 2007/10/19 00:13

devilspie is supposed to keep on running. You might want to add a & to your devilspie-line in your startup script to put the devilspie process into the background:

/usr/bin/devilspie &
doxdox, 2007/10/20 23:02

Is it possible to make devilspie only affect the apps that open when gnome is started? In other word the commands/apps in the “Startup Programs”-tab of Sessions?

tomislavtomislav, 2007/12/10 10:51

I have setup Evolution on workspace 2 & maximize via application_name matcher; How i can have separate rule for individual e-mails windows? Can't do it via window_name since every window has a different name ?

JoelJoel, 2007/12/18 22:02

I did this code:

(if

   (is (window_name) "Buddy List")
(begin
(undecorate)
(skip_tasklist)
(geometry "100x600")
(geometry "+12+105")
(stick)
(opacity 60)
)
)

and it did what I wanted it to do for my pidgin buddy list but it's inconsistent. Sometimes I can't highlight a name of the person that I want to IM, other times when I minimize and then bring my buddy list back up my buddy list is just white (but if I randomly click in it an IM window will come up for whoever “should” be there. Has anyone else had this problem. I removed everything other than (undecorated) and couldn't fix it so I'm assuming it is the undecorated that causes the problem….but….if it's going to have the window around it I might as well not use devilspie, I'm trying to make it look as if my buddy list is embedded in my desktop. Thanks all

With regards to the individual emails, I don't think it's possible, you can either call on the program name or the window name, if there is no consistent pattern for the email messages I doubt you can focus on it. I thought about the same thing for IM's but since the window name changes depending on who I talk to I couldn't think of a logical way to fix it.

j-copj-cop, 2008/01/01 15:09

Is there a way to make a .ds file be executed only once by Devil's Pie? I have a program that launches at start-up and it displays its window which takes up almost the entire screen when it is executed. I figured that a way to hide this window was to have Devil's Pie move it to another workspace, but I only want this to happen the first time the program displays its window, I don't want it to be on that other workspace permanently. Any suggestions on how I would make Devil's Pie act on the .ds file only once?

MaxMax, 2008/01/18 20:05

Hi everyone! Great job on documenting this app.

My terminal configuration

(if

(matches (window_name) "DesktopConsole")
(begin
(pin)
(undecorate)
(skip_pager)
(skip_tasklist)
(wintype "dock")
(below)
(geometry "+50+50")
(geometry "800x600")
)

)

It is possible put the console on desktop, but below the icons?

Thanks

Kai HoernerKai Hoerner, 2008/02/05 09:31

i've tried a lot to achieve this and no - it's not possible. Not without changing the codebase of your desktop application (e.g. nautilus)

the desktop is _one_ big window below all other windows. it's nearly the same as a folders view in nautilus.

wasabiwasabi, 2008/03/04 00:38

awesome guide! very useful. i'm having a problem with the center method, however. this is what i have: [code] (if

 (is (application_name) "Firefox")
(begin
(undecorate)
(unmaximize)
(center)
(geometry "600x300")
)

) [/code]

this is the output in console

[code] wasabi@latitudex1:~/.devilspie$ devilspie

(devilspie:22973): Wnck-CRITICAL : wnck_workspace_get_width: assertion `WNCK_IS_WORKSPACE (space)' failed (devilspie:22973): Wnck-CRITICAL : wnck_workspace_get_height: assertion `WNCK_IS_WORKSPACE (space)' failed [/code]

everything works except the window isn't centered. it can't see to get the size of my workspace. is there anyway i can set this?

Islam AmerIslam Amer, 2008/03/06 13:30

Hello everyone.

First I'd like to thank you for this wonderful guide. It inspired me to create a simple gui to help making these rules. I also wanted an excuse to learn pyGTK.

There is still no release yet, so you will have to check out from svn, but I'd love to get your opinion about it.

http://code.google.com/p/gdevilspie/

Thanks

fooselfoosel, 2008/03/06 13:50

Awesome! I just gave it a quick look, more closer inspection after work, but it was about time somebody created a gui for these rules – have been playing around with the though myself, but never came around to it thanks to all the work *g*

meist3rmeist3r, 2008/03/08 04:36

Maybe you guys can help me, I'm trying to start a Planeshift window in the size of one of my screens (1280×1024) and undecorate it so it looks like fullscreen on one monitor. I do this with a different game too and it works just fine. With Planeshift I can't seem to get Devilspie to spawn the window correctly. It always appears on the secondary monitor and still has the window decorations. The name of the window according to xwininfo is “Crystal Space Application” but neither through (is (window_name)) nor (matches (window_name)) can I get DP to load the window correctly. Anyone know how to improve my match filtering? Right now my string for matching is “Crystal Space Application” but that doesn't work.

HawkHawk, 2008/05/26 03:02

Hi there, Great guide, really helpfull!!

I'm trying to open a terminal in the lower-left corner of my screen I execute xwininfo and put (geometry [corners_value]) but it doesn't work.

[code] (if

      (matches (window_name) "DeskCon")
(begin
(stick)
(below)
(undecorate)
(skip_pager)
(skip_tasklist)
(geometry "+7+593 -711+593 -711-4 +7-4")
(wintype "dock")
)

) [/code]

I'm not sure about wintype also..

Thanks again!

tirengarfiotirengarfio, 2008/05/31 02:59

Hi,

imagine i want to open Firefox and place it to the second work area, and after, open again Firefox and place it this time at the third workspace, is that possible with Devilspie? how?

Bye!

ændrükændrük, 2008/06/02 05:53

Maximize appears to toggle maximization. Am I missing something here?

Using the following configuration, Evince is only maximized every other time I open it, because it remembers the previous state from the last time it was closed. When Evince starts unmaximized, Devilspie maximizes it; when Evince starts maximized, Devilspie unmaximizes it.

(if
(is (application_name) "Evince Document Viewer")
(begin (maximize))
)
Sean HankinsSean Hankins, 2008/06/10 02:03

Hello! I have been trying to get devilspie to work with iceweasel(firefox) and this is what I have found: Firstly, I have a script that prints the following:

(begin
(print (application_name))
(print (window_name))
(print (window_role))
(print (window_class))
(print "")
)

This prints out all of the above information for all of the open windows, including the title of the page currently open in iceweasel. Any further windows open will also print lines while the script is running. I want to be able to move and resize an iceweasel window based on the title of the web page. If I am running the above script, I can see the title as the window_name, however, if I open iceweasel and then browse to the site, it does not recognize it. I have even tried running iceweasel from the command line:

root:~$ iceweasel "www.google.com"

The output displays iceweasel as the window_name and firefox as the application name, but does not show me the title. If I stop the devilspie script and restart it, it shows up as the window_name “Google - Iceweasel”. Any information about this would be appreciated.

Lubos VrbkaLubos Vrbka, 2008/10/10 09:40

hi, did you solve your problem? i am facing the same thing now with version 0.22 from debian testing repositories. when the firefox (iceweasel) starts, it won't get recognized by my .ds rule. on restart of devilspie it works correctly…

Sean HankinsSean Hankins, 2008/06/10 02:04

oops, sorry about the script. apparently 3 brackets wont indent your code?

HunterHunter, 2008/07/19 09:16

Show Desktop?

I've got this: (if

      (is (window_name) "DesktopConsole")
(begin
(undecorate)
(fullscreen)
(skip_tasklist)
(skip_pager)
(pin)
(wintype "dock")
(below)
)

)

But whenever I press Win+D to show my desktop (in Fluxbox) the terminal window disappears! Has anyone found a way to fix this bug?

Thanks!

MikeMike, 2008/08/26 20:14

Is it possible to change a window according to whether it's fullscreen, or depending on it's geometry?

IVanIVan, 2008/08/28 06:38

Hi there. This is an awesome tool. I am trying to use it to automate my startup so that when certain windows open, it is automatically moved to a specific workspace.

I have added it to my Ubuntu sessions, but I think I need to stat the Daemon to make it work? What is the command needed to start the devilspie daemon?

Thanks for a great tool

Michael J. TinsleyMichael J. Tinsley, 2008/12/10 01:13

Ivan: Did you find out how to start the devilspie daemon from the command line yet? If you did, please let me know what it is, so I can put it in my session startup programs. Thanks.

Jose Catre-VandisJose Catre-Vandis, 2008/10/08 23:21

Great guide - best I have found anywhere that unravels many of the mysteries of devilspie, and helped me to do what I wanted - only simple stuff; undecorate mplayer, center thunar and terminal. Here's how (each in a separate .ds file):

[code](if (is (application_name) “MPlayer”) (undecorate) )

(if (is (window_class) “Thunar”) (center) )

(if (is (window_class) “Thunar”) (center) )

(if (matches (window_name) “Terminal”) (center) )[/code]

I will be playing much more though :)

Vincenzo GUIDOVincenzo GUIDO, 2008/10/17 12:10

Somone knows if devilspie give the possibility to embed 2 applications? For examples have an embed calculator into the mozilla?

Thanks

MikeMike, 2009/01/11 17:26

I made scripts for Firefox and Thunderbird to open all windws centered and they worked great, but nothing else (Gnome or KDE) worked with the same syntaxt. I played around and came up with this.

(if(is (application_name) “foo”)

(focus)

(center)

)

This single script in my ~.devilspie folder makes any app or window to open centered; Gnome. KDE, or thrid party apps.

Mike

peterpeter, 2009/01/17 18:31

how do you prevent user input from an application?

because lets say I want to make a animated wallpaper, I would like to send the application to the background and prevent user input, and disable focus. any such way of doing this? thx

fooselfoosel, 2009/01/17 18:45

No. (at least none that I know of)

C.WolfC.Wolf, 2009/02/02 13:47

(center) works well for the combined horizontal center and vertical center.

I would like to know if a feature could be added to allow you to center horizontally as well as vertically, independently without using a static geometry for either x or y.

In my example I would like to raise my avant-window-navigator above (in negative x direction) a panel I have located at the bottom of the screen and still have it vertically centered. whereas utilizing the current geometry and subtracts 50 from current xoffset.

Please Note before you comment: I understand the (above) command raises the z dimension (or layer offset) of the window/object, this is not what I'm looking for.

for example:

( if(is (application_name) “avant-window-navigator”)

(begin
(xoffset "-50")
(vcenter)
(wintype "dock")
(undecorate)
)

)

Any ideas, please let me know how I might be able to achieve this affect, and yet still be able to resize the viewport dynamically. Having positions being properly updated.

Thanks in advance! -C.Wolf (CodeWolf)

C.WolfC.Wolf, 2009/02/02 15:39

Nevermind the above post. I have found another way to manage avant-window-navigator without using devilspie. Just edit the gconf monitor height setting for apps/avant-window-navigator then check the force monitor and keep_below options.

Worked perfectly for me.

Thanks anyways!! :D

PS: those options i stated would still be usefull to other apps.

Kyle C.Kyle C., 2009/02/18 02:27

I am trying to use devil's pie with no window manager (only X is running) but am having difficulties doing so. Is this even possible or do I need to be running some kind of window manager for this tool to work?

Chris GreenChris Green, 2009/02/24 12:43

You need an EWMH (right abbreviation?) compliant window manager for devilspie and/or similar programs to work. So, no, you can't use devilspie without a window manager.

keisangikeisangi, 2009/04/12 11:58

hi there, i'm try do see if i can do this with devilspie:

auto minimize all windows except the active one.

be it upon pressing a hotkey or, running in background all the time to alway keep only one window displayed. someone could help me a bit?

is there a forum or an irc channel for devilspie ?

tnx

BrettBrett, 2009/04/16 22:36

Doesn't seem to be working.

i have the file gnome-terminal.ds in ~/.devilspie

(if

      (matches (application_name) "gnome-terminal")
(set_workspace 4)

)

i run devilspie, then run gnome-terminal and nothing happens

shibu chackoshibu chacko, 2009/05/15 07:50

Hi everybody ,, i am using centos 5.2 i am able to use devilspie application ….. but at login time it doesnot automatically start-up the is no file as ~/.xinitrc or ~/.Xsession .. i even tried with startup→preferences→session but no result…. can anybody help me Thanks in advance

Chuck RobeyChuck Robey, 2009/05/31 20:34

I'm still rereading the docs I've found, but if I could get a hint as to how to do these two items: one, on any particular app, how to get the tags I might be able to use on that app, to control it in scripts. Second, how to make the SECOND appearance of an app (like my 2nd Konsole window) to appear on a particular window (other than the place the first one goes to, and not just another one at random, either). I really commonly run two windows of browser and 2 of terminals, with each one have a particular personal use. I run 9 workspaces, using xfce4 often (I try KDE4 also, sometimes). I use devilspie, have for about a year now, by manually placing the 2nd apps.

Thanks