[How To] Lock Terminal size or Change Any Other Application behaviour in Ubuntu using devilspie


devilspie, a non-gui utility that lets you make applications start in specified workplaces, in specified sizes and placements, minimized or maximized and much more based on simple config files.

ubuntu-logo14


To install devilspie you can use Ubuntu Software Center or run the following command in terminal:
sudo apt-get install devilspie

You can start in terminal devilspie with:
devilspie

Now we are going to configure devilspie to lock gnome-terminal size:

terminal_icon


Create a new directory to store your new devilspie-related configuration file:

mkdir ~/.devilspie

Create a new custom configuration file; for example:
gedit ~/.devilspie/gnome-terminal.ds

Paste in the following configuration code to your new file:
(if (is (application_name) "Terminal")
    (begin
    (undecorate)      
        (geometry "730x450")
        (center)
    )
)

There are some more examples:


Example 1


Move Firefox to workspace 2 and maximize it:
(if
    (is (application_name) "firefox-bin")
    (begin
       (set_workspace 2)
       (maximize)
    )
)

Example 2


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")
    )
)

Example 3


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)
    )
)

Example 4


Move a gaim window that is neither the buddy list nor an IRC conversation:
(if
    (and
        (is (application_name) "gaim")
        (not (is (window_name) "Buddy List"))
        (not (contains (window_name) "#"))
    )
    (geometry "+0+313")
)

Example 5


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")
    )
)