Define a custom shortcut for Compiz Window Manager
Karl Auer
kauer at biplane.com.au
Fri Apr 22 13:36:15 UTC 2016
On Fri, 2016-04-22 at 14:55 +0200, Ralf Mardorf wrote:
> On Fri, 22 Apr 2016 22:48:59 +1000, Karl Auer wrote:
> > In my experiments, wmctrl was perfectly happy with a decimal ID
> > value..
> > .?
>
> Then you didn't use "wmctrl -l -G" to get the size of the original
> active window. Before you can calculate 75% of the original size, you
> need to know the size. How did you get the size using a decimal
> value?
I read the man pages for xdotool :-)
kauer at kt:~$ xdotool getactivewindow
102763394
kauer at kt:~$ xdotool getwindowgeometry --shell 102763394
WINDOW=102763394
X=1028
Y=526
WIDTH=892
HEIGHT=554
SCREEN=0
All values decimal.
So e.g. to set the width of the currently active window to 75% of its
current width:
#!/bin/bash
WIN=$(xdotool getactivewindow)
eval $(xdotool getwindowgeometry --shell $WIN)
WIDTH=$(calc "int($WIDTH*0.75)")
wmctrl -i -r $WIN -e "0,-1,-1,$WIDTH,-1"
Just seems easier than grepping, cutting, echoing and awking...
I put the above in a file, chmodded it to be executable (probably
unnecessary), used the compiz "Commands" module to bind it to a
command, and it works fine.
Regards, K.
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389
GPG fingerprint: E00D 64ED 9C6A 8605 21E0 0ED0 EE64 2BEE CBCB C38B
Old fingerprint: 3C41 82BE A9E7 99A1 B931 5AE7 7638 0147 2C3C 2AC4
More information about the ubuntu-users
mailing list