Results 1 to 10 of 10

Thread: Setting window positions with wmctrl

  1. #1
    Join Date
    Apr 2009
    Beans
    252
    Distro
    Xubuntu 20.04 Focal Fossa

    Setting window positions with wmctrl

    This is on Xubuntu 14.04.1 LTS

    I'm trying to automate certain aspects of my work setup, where I use several different apps and want them distributed over my screen real estate in a certain way.

    I've found wmctrl and some example scripts that use it. Unfortunately wmctrl is very erratic and will sometimes work and sometimes not, which is obviously very frustrating.

    So I'm looking for help: Is there a way to make wmctrl work properly? Are there alternatives? What do others do in my situation?

  2. #2
    Join Date
    Jul 2006
    Location
    Here
    Beans
    11,187

    Re: Setting window positions with wmctrl

    well xfwm is probably fighting you on placement. it has a setting in window tweaks for placement, try turning that all the way up so it only affects large windows.
    Attached Images Attached Images

  3. #3
    Join Date
    Apr 2009
    Beans
    252
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: Setting window positions with wmctrl

    kerry_s: Yes, I had the suspicion there may be a conflict there somewhere, but it seems wmctrl still looses out after applying your tweak.

  4. #4
    Join Date
    Jul 2006
    Location
    Here
    Beans
    11,187

    Re: Setting window positions with wmctrl

    sure it's not your script ?
    can you go in to more detail on what your trying to do ? pic maybe ?

  5. #5
    Join Date
    Apr 2009
    Beans
    252
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: Setting window positions with wmctrl

    Sure, here's screenshot of what I'm trying to do:

    Left two windows go on one screen. The right window goes on another.

    Selection_010.jpg

    Here's an example script I'm using:

    Code:
    #!/bin/bash
    function get_window_id()
    {
    window_id=$(wmctrl -l | grep "$1" | tail -1 | cut -f1 -d" ")
    }
    
    firefox -new-window "website.html"
    get_window_id "Mozilla Firefox"
    wmctrl -i -r "$window_id" -e 0,0,0,950,1080
    
    firefox -new-window "other-webseite.html"
    get_window_id "Mozilla Firefox"
    wmctrl -i -r "$window_id" -e 0,950,0,968,1080
    
    libreoffice --writer "textdoc"
    I don't actually use wmctrl on the last window because the window manager places it where I want it.
    Last edited by texpat; February 8th, 2015 at 10:28 PM.

  6. #6
    Join Date
    Mar 2011
    Location
    U.K.
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Setting window positions with wmctrl

    There is also Window Master .. Firefox Add-on

    https://addons.mozilla.org/en-US/fir...onitor-master/

  7. #7
    Join Date
    Jul 2006
    Location
    Here
    Beans
    11,187

    Re: Setting window positions with wmctrl

    maybe you should look into tiling wm's, xfwm4 can easily be replaced. while still keeping everything else. just a thought.

  8. #8
    Join Date
    Jun 2005
    Location
    Toronto, Canada
    Beans
    Hidden!
    Distro
    Xubuntu 16.04 Xenial Xerus

    Re: Setting window positions with wmctrl

    I use devilspie when I want to place apps in specific locations.

    Also: https://help.ubuntu.com/community/Devilspie

  9. #9
    Join Date
    Aug 2014
    Beans
    Hidden!
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Setting window positions with wmctrl

    I find binding xdotool and wmctrl commands to easystroke mouse gestures invaluable.
    All you need do is draw the gesture on the window you want the command to act on.
    All I change in easystoke is the gesture button from 2 to 3. Feels more natural using the right mouse button.
    Attached Images Attached Images

  10. #10
    Join Date
    Apr 2009
    Beans
    252
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: Setting window positions with wmctrl

    Quote Originally Posted by kerry_s View Post
    maybe you should look into tiling wm's, xfwm4 can easily be replaced. while still keeping everything else. just a thought.
    I played around with Awesome a while ago. Perhaps its time to give it another go.

    Quote Originally Posted by Toz View Post
    I use devilspie when I want to place apps in specific locations.
    Had a quick look at that, too. But it doesn't seem to be what I'm looking for. I want a command to bring up and position app windows. This seems to apply a default behaviour to app windows when they appear. This is not quite what I'm after. I'll have a closer look at that link you gave, though. Thanks!

    Quote Originally Posted by CantankRus View Post
    I find binding xdotool and wmctrl commands to easystroke mouse gestures invaluable.
    All you need do is draw the gesture on the window you want the command to act on.
    All I change in easystoke is the gesture button from 2 to 3. Feels more natural using the right mouse button.
    This is novel to me. Looks like it could be worth a try. Thanks!
    Last edited by texpat; February 10th, 2015 at 05:44 PM.

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
  •