wms/wms_value.sh

74 lines
1.3 KiB
Bash
Executable file

#!/bin/sh
. $HOME/.config/wms/wms_var
FLAG=$1
RID=$(lsw -r) # root window id
usage() {
cat<<EOF
usage:
wms_revalue.sh [ -m, -M ]
-m) minimize tiling master area
-M) maximize tiling master area
EOF
}
mp=$(atomx WM_MP $RID) # tiling master area percent from atom
master_inc() {
if [ $mp -le 80 ]; then
atomx WM_MP=$((mp + 5)) $RID
wms_usher.sh -t
fi
} # 5% + calculation
master_dec() {
if [ $mp -ge 20 ]; then
atomx WM_MP=$((mp - 5)) $RID
wms_usher.sh -t
fi
} # 5% - calculation
wp=$(atomx WM_WP $RID) # windows percent size from atom
windowperc_inc() {
if [ $wp -le 90 ]; then
atomx WM_WP=$((wp + 5)) $RID
wms_usher.sh -w
fi
} # 5% + calculation
windowperc_dec() {
if [ $wp -ge 60 ]; then
atomx WM_WP=$((wp -5)) $RID
wms_usher.sh -w
fi
} # 5% - calculation
if [ -n "$FLAG" ]; then
case $FLAG in
-m) # reduce tiling master area
master_dec
;;
-M) # increase tiling master area
master_inc
;;
-w) # reduce window size
windowperc_dec
;;
-W) # increase window size
windowperc_inc
;;
*)
usage
;;
esac
else
atomx WM_NAME=$NAME $RID # set root window name
atomx WM_WP=$WP $RID # set window percent atom
atomx WM_MP=$MP $RID # set tiling master area percent atom
fi