59 lines
1.1 KiB
Bash
Executable file
59 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
## send windows to desktop background ##
|
|
## it depends of wms_mainrole.sh ##
|
|
|
|
. /tmp/wms_var
|
|
|
|
FLAG=$1
|
|
# focused window.
|
|
FW=$(pfw)
|
|
# root window id.
|
|
RID=$(lsw -r)
|
|
# background window id.
|
|
BID=$(lsw -o)
|
|
# root width.
|
|
RW=$(wattr w $RID)
|
|
# root height.
|
|
RH=$(wattr h $RID)
|
|
# usable screen width.
|
|
SW=$((RW - 2 * BW))
|
|
# usable screen height.
|
|
SH=$((RH - 2 * BW))
|
|
|
|
# send windows to background
|
|
background() {
|
|
# 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_mainrole.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_mainrole.sh $BID
|
|
}
|
|
|
|
if [ -n "$BID" ]; then
|
|
restore
|
|
|
|
else
|
|
background
|
|
fi
|