some code added

This commit is contained in:
rootniformaticaservice 2023-03-13 02:07:04 -03:00
parent 751761aa33
commit 90e05ce576
3 changed files with 66 additions and 7 deletions

55
backgroundize.sh Executable file
View file

@ -0,0 +1,55 @@
#!/bin/sh
## send windows to desktop background ##
. $HOME/.config/rootwm/rwm_var
FLAG=$1
FW=$(pfw) # focused window
RID=$(lsw -r) # root widnow id
RW=$(wattr w $RID) # root width
RH=$(wattr h $RID) # root height
SW=$((RW - 2*BW)) # usable screen width
SH=$((RH - 2*BW)) # usable screen height
usage() {
echo "usage:
nowm_ignore.sh [ -b, -r ]
-b) backgroundize focused window
-r) open menu and choose the window/s to restore"
}
# send windows to background
background() {
if [ ! "$(wattr o $FW && echo 1)" ]; then # if override is not set
wtp 0 0 $SW $SH $FW
ignw -s $FW # ignore focused window
chwb -c 000000 $FW # change border color to ignore
else
ignw -r $FW # unignore focused window
chwb -c $FG $FW # change border color to active
fi
}
# restore windows from background
restore() {
if [ -n "$(lsw -o)" ]; then
otarget=$(for wid in $(lsw -o); do # override target
printf '%s\n' "$wid | $(atomx WM_CLASS $wid) | $(wname $wid)"
done | cut -c 1-100 | $XMENU | cut -d ' ' -f 1)
ignw -r $otarget # unignore otarget
fi
}
case $FLAG in
-b)
background
;;
-r)
restore
;;
*)
usage
;;
esac

View file

@ -132,7 +132,7 @@ super + c
## backgroundize ##
super + {_,shift +}b
rwm_backgroundize.sh {-i,-u}
rwm_backgroundize.sh {-b,-r}
# kill ##
super + {_,shift +}q

View file

@ -4,17 +4,21 @@
. $HOME/.config/rootwm/rwm_var
LOCK="slock" # lock screen monitor
MOFF="xset dpms force off" # poweroff monitor
HB="doas pm-hibernate" # hibernate
RB="doas shutdown -r now" # reboot
POFF="doas shutdown -h now" # poweroff
KBRELOAD="pkill -usr1 -x sxhkd" # keybindings reload
LOCK="slock" # lock screen monitor
MOFF="xset dpms force off" # poweroff monitor
HB="doas pm-hibernate" # hibernate
RB="doas shutdown -r now" # reboot
POFF="doas shutdown -h now" # poweroff
EXIT="pkill wew && pkill sxhkd" # exit session
PROMPT="lock\nmonitor-off\nhalt\nreboot\nsuspend\nlogout"
PROMPT="reload-key\nlock\nmonitor-off\nhalt\nreboot\nsuspend\nlogout"
option=`echo $PROMPT | $XMENU`
if [ ${#option} -gt 0 ]; then
case $option in
reload-key)
$KBRELOAD
;;
lock)
$LOCK
;;