Define a custom shortcut for Compiz Window Manager
Ralf Mardorf
silver.bullet at zoho.com
Fri Apr 22 16:07:09 UTC 2016
The needed packages for Karl's and my scripts are:
http://packages.ubuntu.com/xenial/wmctrl
http://packages.ubuntu.com/xenial/xdotool
http://packages.ubuntu.com/xenial/apcalc
I had no time to test it on my Ubuntu Wily, the scripts work on Arch
with
[rocketmouse at archlinux ~]$ pacman -Q calc wmctrl xdotool
calc 2.12.5.3-1
wmctrl 1.07-4
xdotool 3.20150503.1-1
On Sat, 23 Apr 2016 00:12:32 +1000, Karl Auer wrote:
> #!/bin/bash
> WIN=$(xdotool getactivewindow)
> eval $(xdotool getwindowgeometry --shell $WIN)
> WIDTH=$(calc "int($WIDTH*0.75)")
> wmctrl -i -r $WIN -b remove,maximized_vert,maximized_horz
> wmctrl -i -r $WIN -e "0,-1,-1,$WIDTH,-1"
I tested a variation of the above script with openbox shortcuts and
fbpanel launchers. Workspaces aren't an issue, maximised windows aren't
an issue, but the coordinates of the window position are not always as
hoped for.
[rocketmouse at archlinux ~]$ wmctrl -m
Name: Openbox
Class:
PID: N/A
Window manager's "showing the desktop" mode: OFF
[rocketmouse at archlinux ~]$ grep win7 -B2 -A2 ~/.config/openbox/rc.xml
<keybind key="C-A-7">
<action name="Execute">
<command>win75 -</command>
</action>
</keybind>
--
<keybind key="C-7">
<action name="Execute">
<command>win75</command>
</action>
</keybind>
[rocketmouse at archlinux ~]$ grep win7 -B1 -A1 .config/fbpanel/pre-summery
item {
name = win75 Ctrl+7
image = /usr/share/icons/Adwaita/48x48/actions/zoom-out.png
action = win75
}
item {
name = win75 - Ctrl+A+7
action = win75 -
}
[rocketmouse at archlinux ~]$ cat /usr/local/bin/win75
#!/bin/dash
eval $(xdotool getwindowgeometry --shell $(xdotool getactivewindow))
WIDTH=$(calc "int($WIDTH*0.75)")
case $1 in
"") HEIGHT=$(calc "int($HEIGHT*0.75)");
esac
wmctrl -i -r $WINDOW -b remove,maximized_vert,maximized_horz
wmctrl -i -r $WINDOW -e "0,-1,-1,$WIDTH,$HEIGHT"
exit
More information about the ubuntu-users
mailing list