[conspire] Cool trick- reposition a window (e.g. Firefox) programmatically

Tony Godshall togo at of.net
Thu Oct 7 17:35:08 PDT 2010


You've installed wmctrl from you favorite distro's repo (e.g. #
apt-get update && apt-get install wmctrl )

You've already got Firefox running

1. calculate the dimensions, in this case I want firefox to be full
width, bottom half

$ DISPGEOM=$(xwininfo -root|awk '/-geometry/{print $2}')
$ echo $DISPGEOM

$ DISPW=$(echo "$DISPGEOM"|cut -dx -f1); echo $DISPW
$ DISPH=$(echo "$DISPGEOM"|cut -dx -f2|cut -d+ -f1); echo $DISPH

$ let H=DISPH/2
$ let W=DISPW
$ let x=0
$ let y=DISPH-H

2. Tell the window manager to use that size for the window with
Firefox in its title

$ wmctrl -a 'Firefox' -e 0,$x,$y,$W,$H

Read the manpage for caveats.  Tested to work fine with compiz and
metacity (the defaults for Ubuntu with Appearance ,Effects, None and

Best Regards.

More information about the conspire mailing list