Does not work (yet?) with xfwm 4.13
Here's a little script to extend some functions in xfwm, mimicking behavior in other popular window managers. This allows for:
- Regular Window + (Super+Up) = Maximize
Max Window + (Super+Up) = No action
Max Window + (Super+Down) = Restore
Regular Window + (Super+Down) = Minimize
Tiled Window + (Super+Up) = Maximize
Tiled Window + (Super+Down) = Restore
Note - This doesn't treat quarter tiled windows in any special way. They'll behave as regular windows.
These are just the keybindings I've grown used to over the years, implemented using a script calling wmctrl, xdotool, and xprop. The keybindings can be assigned where ever, I happen to like using the super key.
Protip - If you've got your whisker menu tied to Super_L and want to use Super_L for other bindings as well, have no fear! xcape can help you with that! apt install xcape and run it in your Session and Startup>Application Autostart. My command is
Code: Select all
xcape -e 'Super_L=Super_L|space'
Note - I have left and right tile set to Super+Left and Super+Right in Window Manager>Keyboard.
extrawm.sh:
Code: Select all
#!/bin/bash
#Check if window is maximized or tiled
windowstate=$(xprop -id $(xdotool getwindowfocus) _NET_WM_STATE | cut -d' ' -f3,4,5)
function maximize()
{
if [ "$windowstate" != "_NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_FOCUSED" ] # if window's not maximized,...
then
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz # restore to allow maximzation from tiled/vert maximized state (a little hacky...)
wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz # and, maximize!
fi
}
function restoreorminimize()
{
if [ "$windowstate" == "_NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_FOCUSED" ] # if window is maximized,...
then
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz # restore
elif [ "$windowstate" == "_NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_STATE_FOCUSED" ] # if window is tiled...
then
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz # restore
else # if it's not maxmized or tiled...
xdotool windowminimize $(xdotool getactivewindow) #minimize
fi
}
if [ "$1" = "up" ]; then
$(maximize)
elif [ "$1" = "down" ]; then
$(restoreorminimize)
fi
Code: Select all
/home/rich/bin/extrawm.sh up|down
Thanks for reading, any feedback welcome.