wms/opt/wms_bottom.sh

50 lines
972 B
Bash
Executable file

#!/bin/sh
## send windows to desktop background ##
## it depends of wms_focuser.sh ##
# wms_backgroundize.sh by @root_informatica.
. /tmp/wms_var
FLAG=$1
# focused window.
FW=$(pfw)
# bottomized window id.
BID=$(lsw -o)
# send windows to background
bottom() {
# store size and place of the focused widnow in atom.
atomx WM_IGN="$(wattr xywh $FW) $FW" $FW
# put it on bottom in window stack order.
chwso -l $FW
# make fullsize.
wtp 0 0 $SW $SH $FW
# ignore focused window.
ignw -s $FW
# change border color to BC.
chwb -c $BC $FW
# focus prev window.
wms_focuser.sh -p
}
# restore windows from background
restore() {
# unignore.
ignw -r $BID
# restore size an d place.
wtp $(atomx WM_IGN $BID)
# put it on top in the window stack order.
chwso -r $BID
# delete atom.
atomx -d WM_IGN $BID
# focus it.
wms_focuser.sh $BID
}
if [ -n "$BID" ]; then
restore
else
bottom
fi