wms/wms_value.sh
rootniformaticaservice 02d7662d6d Rename and fixed
2023-05-28 00:00:56 -03:00

83 lines
1.5 KiB
Bash
Executable file

#!/bin/sh
. $HOME/.config/wms/wms_var
FLAG=$1
RID=$(lsw -r) # root window id
usage() {
echo "usage:
wms_revalue.sh [ -m, -M ]
-m) minimize tiling master area
-M) maximize tiling master area"
}
mp=$(atomx WM_MP $RID) # tiling master area percent from atom
master_inc() {
atomx WM_MP=$((mp + 5)) $RID
wms_usher.sh -t
} # 5% + calculation
master_dec() {
atomx WM_MP=$((mp - 5)) $RID
wms_usher.sh -t
} # 5% - calculation
wp=$(atomx WM_WP $RID) # windows percent size from atom
windowperc_inc() {
atomx WM_WP=$((wp + 5)) $RID
wms_usher.sh -w
} # 5% + calculation
windowperc_dec() {
atomx WM_WP=$((wp -5)) $RID
wms_usher.sh -w
} # 5% - calculation
gap=$(atomx WM_GAP $RID)
gap_inc() {
atomx WM_GAP=$((gap + 2)) $RID
wms_usher.sh -t
} # 5 + pixels gaps
gap_dec() {
atomx WM_GAP=$((gap - 2)) $RID
wms_usher.sh -t
} # 5 - pixels gaps
if [ -n "$FLAG" ]; then
case $FLAG in
-g) # reduce gaps
gap_dec
;;
-G) # increase gaps
gap_inc
;;
-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
atomx WM_GAP=$GAP $RID # set tiling gaps
fi