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

Ralf Mardorf silver.bullet at zoho.com
Fri Apr 22 12:27:29 UTC 2016


On Fri, 22 Apr 2016 13:16:08 +0200, Ralf Mardorf wrote:
>The dirty fixed script:
>
>$ cat /usr/local/bin/win75 
>#!/bin/bash

I changed it to
#!/bin/dash
since it might enhance performance.

>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)}' | cut -d"." -f1)
>h=$(echo $win_h | awk '{printf($1*0.75)}' | cut -d"." -f1)

I didn't the following changes, but the OP likely wants to apply those.
Since the OP only wants to shrink the width of an active window, the
above "h="-line can be removed ...

>wmctrl -i -r 0x$window -b remove,maximized_vert,maximized_horz
>wmctrl -i -r 0x$window -e 0,-1,-1,$w,$h

... and I guess replacing $h with -1 does the job for this line, if not
replacing $h with $win_h should work for the above line.
 
>exit
>
>I'm quite sure that there is a simple solution for the math, what I'm
>doing most likely is a joke, but it works.

:D




More information about the ubuntu-users mailing list