A script that does it all: Define a custom shortcut for Compiz Window Manager

Ralf Mardorf silver.bullet at zoho.com
Fri Apr 22 10:19:41 UTC 2016


Hi,

perhaps the OP wants to use my script.

The executable script:

$ cat /usr/local/bin/win75 
#!/bin/bash
window="$(printf '%x' $(xdotool getactivewindow))"
win_w=$(wmctrl -l -G | grep $window | cut -d" " -f11)
win_h=$(wmctrl -l -G | grep $window | cut -d" " -f12)
w=$(echo $win_w | awk '{printf($1*0.75)}')
h=$(echo $win_h | awk '{printf($1*0.75)}')
wmctrl -i -r 0x$window -b remove,maximized_vert,maximized_horz
wmctrl -i -r 0x$window -e 0,-1,-1,$w,$h
exit

An openbox shortcut:

$ grep -A4 C-7 ~/.config/openbox/rc.xml 
    <keybind key="C-7">
      <action name="Execute">
        <command>win75</command>
      </action>
    </keybind>

Restart the WM:

$ openbox --restart

Should work with Compiz as well.

Regards,
Ralf





More information about the ubuntu-users mailing list