wms/rwm_monopolize.sh
rootniformaticaservice e83acb54de several changes
2023-03-06 22:55:30 -03:00

22 lines
708 B
Bash
Executable file

#!/bin/sh
. $HOME/.config/rootwm/rwm_var
FW=$(pfw) # focused window
RW=$(wattr w $(lsw -r)) # root width
RH=$(wattr h $(lsw -r)) # root height
WFW=$((RW - BW * 2)) # window fullsize width
WFH=$((RH - BW * 2)) # window fullsize heigh
TWF="/tmp/rwm_fullsize-$FW" # temporal window file
# if it is in the list and it is in fullsize
if [ -f "$TWF" ] & [ "$(wattr wh $FW)" = "$WFW $WFH" ]; then
wtp $(cat $TWF) $FW # restore size and position
rm $TWF # remove from list
else # if it's not in the list and it's not in fullsize
echo "$(wattr xywh $FW)" > $TWF # gets on the list
wtp 0 0 $WFW $WFH $FW # gets fullsize
fi