This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

Devil's Pie

Note that Devil's Pie isn't really maintained - you may be more interested in the successor project Devil's Pie 2.

Introduction

A totally crack-ridden program for freaks and weirdos who want precise control over what windows do when they appear. If you want all XChat windows to be on desktop 3, in the lower-left, at 40% transparency, you can do it.

http://www.burtonini.com/blog/computers/devilspie

Script Files

Devil's Pie looks for scripts ending with ".ds" in a ".devilspie/" directory in your home directory. To get started writing scripts, you must first create this directory, then create script files within it. Each script file must contain exactly one expression (see below for information on the "begin" expression which lets you group multiple expressions within one.) Each time a new window is created, Devil's Pie executes each script that ends with the ".ds" extension in the ~/.devilspie directory.

Syntax File Reference

TODO

Logical Constructs

if

Syntax:

(if a b)
 
(if a b c)

A conditional flow based on the logical expression a. In the first case, if a is true, b gets executed and nothing otherwise. In the second case, if a is true, b is executed and c otherwise.

Example:

begin

Syntax:

(begin a b c ...)

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

Example:

and

Syntax:

(and a b)

Returns the result of and-ing the logical expressions a and b.

Examples:

or

Syntax:

(or a b)

Returns the result of or-ing the logical expressions a and b.

Examples:

not

Syntax:

(not a)

Returns the negation of the given logical expression a.

Examples:

is

Syntax:

(is a b)

Returns true if strings a and b are the same.

Examples:

contains

Syntax:

(contains haystack needle)

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

Examples:

matches

Syntax:

(matches str pattern)

Returns true if string pattern matches on string str. pattern represents a Regular Expression.

Examples:

Matchers

Matchers return certain properties of the available windows – namely title, name of application and role of the window – and are used to formulate conditions to match certain programs and/or windows they may spawn.

window_name

Syntax:

(window_name) 

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

window_role

Syntax:

(window_role)

Returns a string describing the current window role of the matched window as defined by its WM_WINDOW_ROLE hint.

application_name

Syntax:

(application_name)

Returns a string containing the name of the application that spawned the matched window.

window_workspace

Syntax:

(window_workspace)

Returns an int containing the number of the workspace that the window is on.

window_class

Syntax:

(window_class)

Returns a string, the "class" of the window. Not exactly sure what the semantics are, but it corresponds to the 'Emacs' in the following debug printout:

Window Title: 'emacs-snapshot-gtk@localhost.localdomain'; Application Name: 'emacs-snapshot-gtk'; Class: 'Emacs'; Geometry: 1024x718+0+49

Actions

TODO: maximize, maximize_vertically, maximize_horizontally, minimize, shade, unshade, close, pin, unpin, set_workspace, skip_pager, skip_tasklist, above, below, undecorate, wintype.

debug

Syntax:

(debug)

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

print

Syntax:

(print text)

Prints the string text to stdout, useful for debugging rules.

geometry

Syntax:

(geometry geo)

Sets the geometry of the matched window. geo must be a STRING containing a valid X-GeometryString as parsed by XParseGeometry (see man XParseGeometry for details).

Examples:

fullscreen

Syntax:

(fullscreen)

Sets the matched window into fullscreen mode.

focus

Syntax:

(focus)

Gives focus to the matched window.

center

Syntax:

(center)

Centers the matched window on the screen.

Examples

To use one of the examples below, save it as something.ds in your ~/devilspie directory.

The following script sets the Geometry of the Gaim Buddy List to be the upper right corner of my screen. It could probably be modified to count pixels from the right instead of using the large, 2255 value.

(if
    (and
        (is (application_name) "gaim")
        (is (window_role) "buddy_list"))
    (geometry "300x500+2255+0"))

This script sets all Gaim windows to be pinned across all desktops. This is helpful for not losing conversations on a desktop you switched from recently. It moves the Buddy List too because clicking the buddy list icon in the Notification Area takes extra clicks when the Buddy List is left open on another desktop and can be confusing.

(if
    (is (application_name) "gaim")
    (pin "TRUE"))

See also

http://wiki.foosel.net/linux/devilspie - the fullest manual on Devil's pie I've found


2024-10-23 11:36