increase/decrease options added.

This commit is contained in:
#root_informatica 2024-09-17 00:51:39 -03:00
parent 057a8046cf
commit 392ed285b6

View file

@ -12,6 +12,7 @@ FW=$(pfw)
AMW=$(lsw)
# count maped windows.
CMW=$(lsw | wc -l)
WMSVAR="/tmp/wms_var"
usage() {
cat<<EOF
@ -52,7 +53,7 @@ tiling() {
swidth=$((sw - mwidth - GAP - 2 * BW))
# stack height.
# if swcount in 0 or not.
# if swcount is 0 or not.
[ "$swcount" = "0" ] && sheight=ssh \
|| sheight=$((ssh / swcount - GAP - 2 * BW))
@ -101,6 +102,42 @@ widespread() {
done
}
# increase gaps. (+2 pixels)
gap_inc() {
[ $GAP -le 40 ] && \
sed -i "s/^.*\bGAP=\b.*$/GAP=$((GAP + 2))/" $WMSVAR
}
# decrease gaps. (-2 pixels)
gap_dec() {
[ $GAP -ge 2 ] && \
sed -i "s/^.*\bGAP=\b.*$/GAP=$((GAP - 2))/" $WMSVAR
}
# increase master area. (+5 pixels)
master_inc() {
[ $MP -le 70 ] && \
sed -i "s/^.*\bMP=\b.*$/MP=$((MP + 5))/" $WMSVAR
}
# decrease master area. (-5 pixels)
master_dec() {
[ $MP -ge 40 ] && \
sed -i "s/^.*\bMP=\b.*$/MP=$((MP - 5))/" $WMSVAR
}
# increase window percentage. (+5 %)
windowperc_inc() {
[ $WP -le 90 ] && \
sed -i "s/^.*\bWP=\b.*$/WP=$((WP + 5))/" $WMSVAR
}
# decrease window percentage. (-5 %)
windowperc_dec() {
[ $WP -ge 60 ] && \
sed -i "s/^.*\bWP=\b.*$/WP=$((WP - 5))/" $WMSVAR
}
# if there is a focused window.
if [ -n "$FW" ]; then
case $FLAG in
@ -113,6 +150,30 @@ if [ -n "$FW" ]; then
-w)
widespread
;;
-a)
master_dec
. /tmp/wms_var && tiling
;;
-A)
master_inc
. /tmp/wms_var && tiling
;;
-g)
gap_dec
. /tmp/wms_var && tiling
;;
-G)
gap_inc
. /tmp/wms_var && tiling
;;
-p)
windowperc_dec
. /tmp/wms_var && widespread
;;
-P)
windowperc_inc
. /tmp/wms_var && widespread
;;
*)
usage
;;