2023-03-06 19:08:25 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-09-14 03:56:57 +02:00
|
|
|
# check if there is variable file in /tmp for source. if it's not there, copy it
|
|
|
|
if [ -f /tmp/wms_var ]; then
|
|
|
|
. /tmp/wms_var
|
|
|
|
else
|
|
|
|
cp $HOME/.config/wms/wms_var /tmp/wms_var
|
|
|
|
. /tmp/wms_var
|
|
|
|
fi
|
|
|
|
|
|
|
|
FLAG=$1 # input
|
|
|
|
RID=$(lsw -r) # root window id
|
|
|
|
FW=$(pfw) # focused window
|
|
|
|
WMSVAR="/tmp/wms_var" # variable temporary file
|
2023-03-06 19:08:25 +01:00
|
|
|
|
|
|
|
usage() {
|
2023-07-24 08:08:48 +02:00
|
|
|
cat<<EOF
|
|
|
|
usage:
|
2023-09-26 06:25:05 +02:00
|
|
|
wms_revalue.sh [ -b, -B, -d, -g, -G, -m, -M, -w, -W]
|
2023-08-15 05:25:18 +02:00
|
|
|
-b) minimize borderwidth
|
|
|
|
-B) maximize borderwidth
|
2023-09-26 06:25:05 +02:00
|
|
|
-d) load default
|
2023-08-15 05:25:18 +02:00
|
|
|
-g) minimize gaps
|
2023-09-14 03:56:57 +02:00
|
|
|
-G) maximize
|
2023-03-06 19:08:25 +01:00
|
|
|
-m) minimize tiling master area
|
2023-07-24 08:08:48 +02:00
|
|
|
-M) maximize tiling master area
|
2023-08-15 05:25:18 +02:00
|
|
|
-w) minimize window percentage
|
|
|
|
-W) maximize window percentage
|
2023-07-24 08:08:48 +02:00
|
|
|
EOF
|
2023-03-06 19:08:25 +01:00
|
|
|
}
|
|
|
|
|
2023-08-15 05:25:18 +02:00
|
|
|
border_inc() {
|
|
|
|
if [ $BW -le 10 ]; then
|
|
|
|
sed -i "s/^.*\bBW=\b.*$/BW=$((BW + 2))/" $WMSVAR
|
|
|
|
wms_mainrole.sh $FW
|
|
|
|
fi
|
|
|
|
} # +2 pixel calculation
|
|
|
|
|
|
|
|
border_dec() {
|
|
|
|
if [ $BW -ge 4 ]; then
|
|
|
|
sed -i "s/^.*\bBW=\b.*$/BW=$((BW - 2))/" $WMSVAR
|
|
|
|
wms_mainrole.sh $FW
|
|
|
|
fi
|
|
|
|
} # -2 pixel calculation
|
|
|
|
|
|
|
|
gap_inc() {
|
|
|
|
if [ $GAP -le 40 ]; then
|
|
|
|
sed -i "s/^.*\bGAP=\b.*$/GAP=$((GAP + 2))/" $WMSVAR
|
|
|
|
wms_usher.sh -t
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
gap_dec() {
|
|
|
|
if [ $GAP -ge 2 ]; then
|
|
|
|
sed -i "s/^.*\bGAP=\b.*$/GAP=$((GAP - 2))/" $WMSVAR
|
|
|
|
wms_usher.sh -t
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-03-07 12:54:01 +01:00
|
|
|
master_inc() {
|
2023-08-08 04:42:24 +02:00
|
|
|
if [ $MP -le 80 ]; then
|
2023-08-15 05:25:18 +02:00
|
|
|
sed -i "s/^.*\bMP=\b.*$/MP=$((MP + 5))/" $WMSVAR
|
2023-07-10 02:52:44 +02:00
|
|
|
wms_usher.sh -t
|
|
|
|
fi
|
2023-03-08 04:10:19 +01:00
|
|
|
} # 5% + calculation
|
2023-03-06 19:08:25 +01:00
|
|
|
|
|
|
|
master_dec() {
|
2023-08-08 04:42:24 +02:00
|
|
|
if [ $MP -ge 20 ]; then
|
2023-08-15 05:25:18 +02:00
|
|
|
sed -i "s/^.*\bMP=\b.*$/MP=$((MP - 5))/" $WMSVAR
|
2023-07-10 02:52:44 +02:00
|
|
|
wms_usher.sh -t
|
|
|
|
fi
|
2023-03-08 04:10:19 +01:00
|
|
|
} # 5% - calculation
|
2023-03-07 12:54:01 +01:00
|
|
|
|
|
|
|
windowperc_inc() {
|
2023-08-08 04:42:24 +02:00
|
|
|
if [ $WP -le 90 ]; then
|
2023-08-15 05:25:18 +02:00
|
|
|
sed -i "s/^.*\bWP=\b.*$/WP=$((WP + 5))/" $WMSVAR
|
2023-07-10 02:52:44 +02:00
|
|
|
wms_usher.sh -w
|
|
|
|
fi
|
2023-03-08 04:10:19 +01:00
|
|
|
} # 5% + calculation
|
2023-03-06 19:08:25 +01:00
|
|
|
|
2023-03-07 12:54:01 +01:00
|
|
|
windowperc_dec() {
|
2023-08-08 04:42:24 +02:00
|
|
|
if [ $WP -ge 60 ]; then
|
2023-08-15 05:25:18 +02:00
|
|
|
sed -i "s/^.*\bWP=\b.*$/WP=$((WP - 5))/" $WMSVAR
|
2023-07-10 02:52:44 +02:00
|
|
|
wms_usher.sh -w
|
|
|
|
fi
|
2023-03-08 04:10:19 +01:00
|
|
|
} # 5% - calculation
|
2023-03-12 04:54:44 +01:00
|
|
|
|
2023-03-06 19:08:25 +01:00
|
|
|
if [ -n "$FLAG" ]; then
|
|
|
|
case $FLAG in
|
2023-08-15 05:25:18 +02:00
|
|
|
-b) # decrease border width
|
|
|
|
border_dec
|
|
|
|
;;
|
|
|
|
-B) # increase border width
|
|
|
|
border_inc
|
|
|
|
;;
|
2023-09-26 06:25:05 +02:00
|
|
|
-d) # load defaults
|
|
|
|
cp $HOME/.config/wms/wms_var /tmp/wms_var
|
|
|
|
;;
|
2023-08-15 05:25:18 +02:00
|
|
|
-g) # decrease gaps
|
|
|
|
gap_dec
|
|
|
|
;;
|
|
|
|
-G) # increase gaps
|
|
|
|
gap_inc
|
|
|
|
;;
|
2023-03-08 04:10:19 +01:00
|
|
|
-m) # reduce tiling master area
|
2023-03-06 19:08:25 +01:00
|
|
|
master_dec
|
|
|
|
;;
|
2023-03-08 04:10:19 +01:00
|
|
|
-M) # increase tiling master area
|
2023-03-07 12:54:01 +01:00
|
|
|
master_inc
|
|
|
|
;;
|
2023-03-08 04:10:19 +01:00
|
|
|
-w) # reduce window size
|
2023-03-07 12:54:01 +01:00
|
|
|
windowperc_dec
|
|
|
|
;;
|
2023-03-08 04:10:19 +01:00
|
|
|
-W) # increase window size
|
2023-03-07 12:54:01 +01:00
|
|
|
windowperc_inc
|
2023-03-06 19:08:25 +01:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
else
|
2023-08-08 04:42:24 +02:00
|
|
|
exit 0
|
2023-03-06 19:08:25 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|