simplified code

This commit is contained in:
rootniformaticaservice 2023-03-15 01:40:44 -03:00
parent 1750386f20
commit 9fdf2628b5
3 changed files with 41 additions and 33 deletions

View file

@ -15,7 +15,7 @@ I am learning, discovering, experimenting. This makes these scripts very volatil
**My thanks and credits to the wmutils project. I wish you luck on your way.**
**FEATURES:**
· switch windows with menú.
· switch windows with menú. (dmenu, fzfmenu, etc.)
-next / prev / wid.
· window border colors.
@ -24,6 +24,10 @@ I am learning, discovering, experimenting. This makes these scripts very volatil
-fullsize.
-half screen (north, south, est, west).
· send windows to the background and ingore them.
· cicle opened terminals.
· clear desktop.
· herds (group windows by herd).
@ -36,6 +40,8 @@ I am learning, discovering, experimenting. This makes these scripts very volatil
-widespread.
-tiled.
· resize windows percentage.
· resize windows percentage. (regarding screen size)
· resize master area in tiling mode.
**this wm doesn't have mouse support**

View file

@ -18,20 +18,18 @@ rwm_clearer.sh [ -c, -r ]
clear() {
if [ -n $FW ]; then
for wid in $(lsw); do
atomx WM_CL=True $wid
atomx WM_CL=$wid $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
map_wind=$(atomx WM_CL $(lsw -u))
if [ -n "$map_wind" ]; then
mapw -m $map_wind
atomx -d WM_CL $map_wind
fi
done
}
case $FLAG in

View file

@ -1,6 +1,6 @@
#!/bin/sh
## sort windows by flock ##
## sort windows by herds/flock ##
. $HOME/.config/rootwm/rwm_var
@ -11,7 +11,7 @@ AMW=$(lsw) # all maped windows
usage() {
echo "usage:
rwm_groups.sh [ -a, -r, -t ]
rwm_shepperd.sh [ -a, -r, -t ]
-a) add
-A) add all
-d) delete
@ -19,39 +19,43 @@ rwm_groups.sh [ -a, -r, -t ]
-t) togle"
}
name() {
$XMENU < $NAMES
}
# create atom in focused window
add_focused() {
atomx WM_GROUP=$($XMENU < $NAMES) $FW
if [ -n "name" ]; then
atomx WM_HERD="$(name)_$FW" $FW
fi
}
# create atom in all maped windows
add_all() {
atomx WM_GROUP=$($XMENU < $NAMES) $AMW
if [ -n "name" ]; then
for wid in $(lsw); do
atomx WM_HERD="$(name)_$wid" $wid
done
fi
}
# delete atom from focused window
del_focused() {
atomx -d WM_GROUP $FW
atomx -d WM_HERD $FW
}
del_all() {
atomx -d WM_GROUP $AMW
atomx -d WM_HERD $AMW
}
# togle groups
togle() {
groups=$(atomx WM_GROUP $(lsw -a) | sort -u) # groups
if [ -n "$groups" ]; then # check if any grpup exist
gtarget=$(printf "$groups" | $XMENU) # select group target
utarget=$(for wid in $(lsw -u); do # unmaped targets
printf '%s\n' "$wid $(atomx WM_GROUP $wid)" | grep $gtarget
done)
mtarget=$(for wid in $(lsw); do # maped targets
if [ -n "$(atomx WM_GROUP $wid)" ]; then
printf '%s\n' "$wid $(atomx WM_GROUP $wid)" | grep -v $gtarget
fi
done)
mapw -m $utarget & mapw -u $mtarget # map utargets and unmap mtargets
herds=$(atomx WM_HERD $(lsw -a) | cut -d '_' -f1 | sort -u) # herds
if [ -n "$herds" ]; then # check if any herd exist
h_target=$(printf "$herds" | $XMENU) # select herd target
map_wind=$(atomx WM_HERD $(lsw -u) | grep $h_target | cut -d '_' -f2) # windows to map
unmap_wind=$(atomx WM_HERD $(lsw) | grep -v $h_target | cut -d '_' -f2) # windows to unmap
mapw -m $map_wind & mapw -u $unmap_wind
fi
}