Results 1 to 3 of 3

Thread: HOWTO: Center / Re-position Windows

  1. #1
    Join Date
    Jan 2006
    Location
    Cannock, UK
    Beans
    1,276
    Distro
    Ubuntu

    HOWTO: Center / Re-position Windows

    Have you noticed how some application windows will open with strange positioning, e.g. off to the left? Want to change that? Well now you can...

    In this example I will use Firefox (this also works for Swiftfox without changing any code)

    First, install "devilspie", this is available via Synaptic.

    Devilspie
    Find windows and perform actions on them
    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.
    Once installed, go to your home directory and create a new hidden folder called .devilspie

    In the folder you just created, create a document and call it Firefox.ds

    Open up Firefox.ds with a text editor and paste the following:

    Code:
    (if
        (matches (application_name) "Firefox")
        
           (geometry "+120+0")      
    )
    The first number is the X axis (horizontal position) and the second is the Y axis (vertical position).

    The figure I am using (+120) is based on a screen resolution of 1280x1024 so you may need to change this if you find it's not perfectly centered.

    Now to test it!

    Open up a terminal window.

    Type:

    Code:
    devilspie
    If you already have an un-maximised/un-minimised Firefox/Swiftfox window open you should see it reposition itself. if not, just open one up and it should open in it's new position rather than to the left of the screen.

    Once you are happy with the x axis position you'll want to add it to startup.

    System -> Preferences -> Sessions -> Startup Programs -> Add ->> devilspie

    Logout and back in to test - all should work fine.

    If you want to use positioning on more than one window then simply create another .ds file for it.

    There are of course more uses for devilspie, please see the wiki here:

    https://wiki.ubuntu.com/Devilspie?hi...28devilspie%29
    Last edited by _simon_; January 26th, 2007 at 09:05 AM.

  2. #2
    Join Date
    Dec 2006
    Beans
    Hidden!
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: HOWTO: Center / Re-position Windows

    Well I realize this is an old post, but this works great!

    I do have a java program that it won't work on, (the prog tries to open in the custom spot i designated, but flickers and goes back to its default).

    This was on Feisty.

  3. #3
    Join Date
    Oct 2006
    Beans
    584
    Distro
    Ubuntu

    Re: HOWTO: Center / Re-position Windows

    Ok, this post is old but just in case someone is interested, you can center the window with (I am using it with mplayer):

    Code:
    (if
        (matches (application_name) "MPlayer")
           (center)
    )

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •