Summarized: Define a custom shortcut for Compiz Window Manager

Ralf Mardorf silver.bullet at
Fri Apr 22 09:48:27 UTC 2016


Get the active window:

$ window="$(printf '%x' $(xdotool getactivewindow))"

Get the size of the active window:

$ win_w=$(wmctrl -l -G | grep $window | cut -d" " -f11)
$ win_h=$(wmctrl -l -G | grep $window | cut -d" " -f12)

Do the wanted math for $win_w and $win_h to get $w and $h.

Ensure that the window isn't maximised:

wmctrl -i -r 0x$window -b remove,maximized_vert,maximized_horz

Resize the Window:

$ wmctrl -i -r 0x$window -e 0,-1,-1,$w,$h

In short, even the grep vs wmctrl x0???????? issue is solved, only the
math is missing. Ok, assumed a window title should have the same name
as another window's ID, there still is a grep issue ;).

More information about the ubuntu-users mailing list