This commit is contained in:
rootniformaticaservice 2023-03-13 23:29:50 -03:00
parent 90e05ce576
commit 7c0de5922b

View file

@ -4,15 +4,47 @@
. $HOME/.config/rootwm/rwm_var
CWL="/tmp/nowm_cwl" # cleared windows list
CWLD=$(cat $CWL | grep "$(lsw -u)") # difference between CWL and currently unmapped windows.
FLAG=$1
FW=$(pfw) # focused window
CL=$(atomx WM_CL $FW) # clearrer atom
usage() {
echo "usage:
rwm_clearer.sh [ -c, -r ]
-c) clear desktop
-r) restore windows"
}
clear() {
if [ -n $FW ]; then
for wid in $(lsw); do
atomx WM_CL=True $wid
mapw -u $wid
done
fi
}
restore() {
for wid in $(lsw -u); do
wm_cl=$(atomx WM_CL $wid)
if [ -n "$wm_cl" ]; then
mapw -m $wid
atomx -d WM_CL $wid
fi
done
}
case $FLAG in
-c)
clear
;;
-u)
restore
;;
*)
usage
;;
esac
if [ -f $CWL ]; then # if CWL file exist
mapw -m $CWLD # restore windows that have not been mapped yet
rm $CWL # remove CWL file
else # if CWL file not exist
lsw > $CWL # create file with maped windows
mapw -u $(lsw) # clear desktop
fi