Compare commits

...

2 commits

Author SHA1 Message Date
#root_informatica 88b7e8575e final line added. 2024-01-21 00:07:47 -03:00
#root_informatica 9dbe1ebba4 corrections in comments 2024-01-21 00:05:04 -03:00
19 changed files with 309 additions and 154 deletions

View file

@ -87,4 +87,5 @@ clock applet made with dzen2 to show system details and clock.
**[wms_screensaver.sh]** **[wms_screensaver.sh]**
experimental scripts that keps windows in a loop of random movements. experimental scripts that keps windows in a loop of random movements.
**This spawn doesn't have mouse support** **This spawn doesn't have mouse support**
**Sorry for the verbosity of the comments, the idea is to explain each script in general terms so that it can be easier to hack them**

31
batlarm.sh Executable file
View file

@ -0,0 +1,31 @@
#!/bin/sh
## alternating window border colors depending on battery charge ##
## this script depends on power.sh which is in the /others repo ##
. /tmp/wms_var
# freq.
FREQ=0.5
# alternate colors.
COLORS="aa0000 $AC"
while true:; do
# battery status.
read -r STATUS < /sys/class/power_supply/BAT0/status
# if status discharging.
if [ "$STATUS" = "Discharging" ]; then
# alternate border colors.
for c in $COLORS; do
chwb -c $c $(pfw)
sleep $FREQ
done
else # if not
# default border colors.
chwb -c $AC $(pfw)
# exit loop.
break
fi
done

View file

@ -6,31 +6,49 @@
. /tmp/wms_var . /tmp/wms_var
FLAG=$1 FLAG=$1
FW=$(pfw) # focused window # focused window.
RID=$(lsw -r) # root widnow id FW=$(pfw)
BID=$(lsw -o) # bachground window id # root window id.
RW=$(wattr w $RID) # root width RID=$(lsw -r)
RH=$(wattr h $RID) # root height # background window id.
SW=$((RW - 2 * BW)) # usable screen width BID=$(lsw -o)
SH=$((RH - 2 * BW)) # usable screen height # root width.
RW=$(wattr w $RID)
# root height.
RH=$(wattr h $RID)
# usable screen width.
SW=$((RW - 2 * BW))
# usable screen height.
SH=$((RH - 2 * BW))
# send windows to background # send windows to background
background() { background() {
atomx WM_IGN="$(wattr xywh $FW) $FW" $FW # store size and place in atom # store size and place of the focused widnow in atom.
chwso -l $FW # put on bottom in window stack order atomx WM_IGN="$(wattr xywh $FW) $FW" $FW
wtp 0 0 $SW $SH $FW # fullsize # put it on bottom in window stack order.
ignw -s $FW # ignore focused window chwso -l $FW
chwb -c $BC $FW # change border color to ignore # make fullsize.
wms_mainrole.sh -p # focus prev window wtp 0 0 $SW $SH $FW
# ignore focused window.
ignw -s $FW
# change border color to BC.
chwb -c $BC $FW
# focus prev window.
wms_mainrole.sh -p
} }
# restore windows from background # restore windows from background
restore() { restore() {
ignw -r $BID # unignore # unignore.
wtp $(atomx WM_IGN $BID) # restore size and place ignw -r $BID
chwso -r $BID # put on top in the window stack order # restore size an d place.
atomx -d WM_IGN $BID # delete atom wtp $(atomx WM_IGN $BID)
wms_mainrole.sh $BID # focus # put it on top in the window stack order.
chwso -r $BID
# delete atom.
atomx -d WM_IGN $BID
# focus it.
wms_mainrole.sh $BID
} }
if [ -n "$BID" ]; then if [ -n "$BID" ]; then

View file

@ -5,18 +5,26 @@
. /tmp/wms_var . /tmp/wms_var
FLAG=$1 FLAG=$1
FW=$(pfw) # focused window # fucused window.
CL=$(atomx WM_CL $FW) # clearrer atom FW=$(pfw)
AMW=$(lsw) # all maped windows # clearer atom.
UW=$(atomx WM_CL $(lsw -u)) # unmaped windows CL=$(atomx WM_CL $FW)
# all maped windows.
AMW=$(lsw)
# unmaped widnows.
UW=$(atomx WM_CL $(lsw -u))
if [ -n "$UW" ]; then # if unmaped windows # if unmaped windows exist.
mapw -m $UW # map them if [ -n "$UW" ]; then
atomx -d WM_CL $UW # delete atom # map them.
mapw -m $UW
# delete atom.
atomx -d WM_CL $UW
else # if no unmaped windows else # if no unmaped windows
for wid in $(lsw); do # unmaped them and create atom.
atomx WM_CL=$wid $wid for wid in $(lsw); do
done # create atom atomx WM_CL=$wid $wid
mapw -u $AMW # unmap windows done
mapw -u $AMW
fi fi

View file

@ -5,10 +5,11 @@
. /tmp/wms_var . /tmp/wms_var
TARGET=$(for wid in $(lsw); do # search for editor window open.
TARGET=$(for wid in $(lsw -a); do
printf '%s\n' "$wid $(atomx WM_CLASS $wid)" printf '%s\n' "$wid $(atomx WM_CLASS $wid)"
done | grep $XENAME | cut -d ' ' -f1) done | grep $XENAME | cut -d ' ' -f1)
# if editor window is open, focus it; else, start editor.
[ $TARGET ] && wms_mainrole.sh $TARGET \ [ $TARGET ] && wms_mainrole.sh $TARGET \
|| $XECMD || $XECMD

View file

@ -2,7 +2,6 @@
. /tmp/wms_var . /tmp/wms_var
$TERMINAL -name 'xlauncher' \ $TERMINAL -name 'wms_launcher' \
-g $GEOMETRY \ -g $GEOMETRY \
-bg "#$BC" \
-e bash -c 'cmd=$(compgen -c | sort -u | grep -v fzf | fzf --bind 'ctrl-e:print-query' --no-sort); setsid -f $cmd' -e bash -c 'cmd=$(compgen -c | sort -u | grep -v fzf | fzf --bind 'ctrl-e:print-query' --no-sort); setsid -f $cmd'

View file

@ -5,6 +5,7 @@
. /tmp/wms_var . /tmp/wms_var
FLAG=$1 FLAG=$1
# focused window.
FW=$(pfw) FW=$(pfw)
usage() { usage() {
@ -62,6 +63,7 @@ esac
# transfer focus # transfer focus
wtf $wid wtf $wid
# set borders # set colors on the unfocused windows.
chwb -s $BW -c $IC $(lsw | grep -v $(pfw)) # unfocused color chwb -s $BW -c $IC $(lsw | grep -v $(pfw))
chwb -s $BW -c $AC $(pfw) # focused color # set colors on the focused widnow.
chwb -s $BW -c $AC $(pfw)

View file

@ -2,7 +2,6 @@
. /tmp/wms_var . /tmp/wms_var
$TERMINAL -name "xmenu" \ $TERMINAL -name "wms_menu" \
-g $GEOMETRY \ -g $GEOMETRY \
-bg "#$BC" \
-e "fzf --bind 'ctrl-e:print-query' --no-sort $* < /proc/$$/fd/0 > /proc/$$/fd/1" -e "fzf --bind 'ctrl-e:print-query' --no-sort $* < /proc/$$/fd/0 > /proc/$$/fd/1"

View file

@ -1,10 +1,15 @@
#!/bin/sh #!/bin/sh
TMPIMG="/tmp/mimic.png" # temp image target # temp image target.
TMPCOL="/tmp/tmpcol" # temp extracted colors file TMPIMG="/tmp/mimic.png"
WMSVAR="$HOME/.config/wms/wms_var" # window manager variables # temp extracted colors file.
XVAR="$HOME/.Xresources" # default x variable file TMPCOL="/tmp/tmpcol"
NC="3" # number of colors to extract # window manager variables.
WMSVAR="$HOME/.config/wms/wms_var"
# default x variables file.
XVAR="$HOME/.Xresources"
# number of colors to extract.
NC="3"
# spy on what's on the desktop # spy on what's on the desktop
import -w root $TMPIMG import -w root $TMPIMG

View file

@ -4,13 +4,19 @@
. /tmp/wms_var . /tmp/wms_var
FLAG=$1 # flag FLAG=$1
FW=$(pfw) # focused window id # focused window id.
RID=$(lsw -r) # root window id FW=$(pfw)
RW=$(wattr w $RID) # root window width # root window id.
RH=$(wattr h $RID) # root window heigth RID=$(lsw -r)
SW=$((RW - 2 * BW - 2 * GAP)) # screen utilizable width # root window width.
SH=$((RH - 2 * BW - 2 * GAP)) # screen utilizable height RW=$(wattr w $RID)
# root window height.
RH=$(wattr h $RID)
# screen utilizable width.
SW=$((RW - 2 * BW - 2 * GAP))
# screen utilizable height.
SH=$((RH - 2 * BW - 2 * GAP))
usage() { usage() {
cat<<EOF cat<<EOF
@ -66,28 +72,33 @@ west() {
# fulsize function # fulsize function
fullsize() { fullsize() {
fs=$(atomx WM_FS $FW) # atom fullsize and original size position # original size and position.
fs_width=$((RW - BW * 2)) # fullsize width osp=$(atomx WM_FS $FW)
fs_height=$((RH - BW * 2)) # fullsize height # fullsize width.
fs_width=$((RW - BW * 2))
# fullsize height.
fs_height=$((RH - BW * 2))
x=0 x=0
y=0 y=0
# if atom exist and it is in fullsize # if atom exist and it is in fullsize
if [ -n "$fs" ] & [ "$(wattr wh $FW)" = "$fs_width $fs_height" ]; then if [ -n "$osp" ] & [ "$(wattr wh $FW)" = "$fs_width $fs_height" ]; then
wtp $fs $FW # restore size and position # restore size and position.
atomx -d WM_FS $FW # remove atom from window wtp $osp $FW
# remove atom from window.
atomx -d WM_FS $FW
else # if it's not atom and it's not in fullsize else # if it's not atom and it's not in fullsize
atomx WM_FS="$(wattr xywh $FW)" $FW # create atom and save original size an position # create atom and save original size and position.
wtp $x $y $fs_width $fs_height $FW # fullsize atomx WM_FS="$(wattr xywh $FW)" $FW
# fullsize it.
wtp $x $y $fs_width $fs_height $FW
fi fi
} }
case $FLAG in case $FLAG in
-f) -f)
fullsize fullsize
wtp $x $y $w $h $FW
;; ;;
-n) -n)
north north

View file

@ -15,26 +15,26 @@ clock() {
# kill dzen # kill dzen
DZPID=$(pgrep dzen) DZPID=$(pgrep dzen)
if [ -n "$DZPID" ]; then # if pid exist if [ -n "$DZPID" ]; then
pkill dzen # kill'em all pkill dzen
pkill wms_dz.sh pkill wms_dz.sh
else else
case $FLAG in case $FLAG in
-c) -c) # make a simple clock.
clock | dzen2 -fn Hack-80 \ clock | dzen2 -fn Hack-80 \
-fg "#$BC" -bg "#$AC" \ -fg "#$BC" -bg "#$AC" \
-w 360 -h 120 -x 500 -y 300 \ -w 360 -h 120 -x 500 -y 300 \
& &
;; ;;
-f) -f) # make a simple fetch.
sfetch.sh | dzen2 -fn Hack-14 \ sfetch.sh | dzen2 -fn Hack-14 \
-e 'onstart=uncollapse' -l 16 \ -e 'onstart=uncollapse' -l 16 \
-fg "#$BC" -bg "#$AC" \ -fg "#$BC" -bg "#$AC" \
-w 960 -x 200 -y 160 -p \ -w 960 -x 200 -y 160 -p \
& &
;; ;;
-s) -s) # make a simple status.
status.sh | dzen2 -fn Hack-14 \ status.sh | dzen2 -fn Hack-14 \
-e 'onstart=uncollapse' -l 7 \ -e 'onstart=uncollapse' -l 7 \
-fg "#$BC" -bg "#$AC" \ -fg "#$BC" -bg "#$AC" \

View file

@ -4,29 +4,41 @@
. /tmp/wms_var . /tmp/wms_var
INPUT=$1 # input FLAG=$1
FW=$(pfw) # focused window # focused window.
SW=$(wattr w $(lsw -r)) # screen width FW=$(pfw)
SH=$(wattr h $(lsw -r)) # screen height # screen width.
WW=$((SW * 80 / 100)) # windows width = 80% of the screen SW=$(wattr w $(lsw -r))
WH=$((SH * 80 / 100)) # windows height = 80% of the screen # screen height.
MAXX=$((SW - WW)) # max X coordinate SH=$(wattr h $(lsw -r))
MAXY=$((SH - WH)) # max Y coordinate # windows width = 80% of the screen.
FREQ=20 # refresh frequency WW=$((SW * 80 / 100))
# windows height = 80% of the screen.
WH=$((SH * 80 / 100))
# max X coordinate.
MAXX=$((SW - WW))
# max Y coordinate.
MAXY=$((SH - WH))
# refresh freq.
FREQ=20
usage() { usage() {
echo "usage: cat<<EOF
usage:
wms_screensaver.sh [ -a, -f ] wms_screensaver.sh [ -a, -f ]
-a) all windows -a) all windows
-f) focused window" -f) focused window
EOF
} }
# random movement for all windowsaver # random movement for all windowsaver
all_win() { all_win() {
while true; do while true; do
for wid in $(lsw); do for wid in $(lsw); do
x=$(shuf -i 0-$MAXX -n 1) # random x coordinate # random x coordinate.
y=$(shuf -i 0-$MAXY -n 1) # random y coordinate x=$(shuf -i 0-$MAXX -n 1)
# random y coordinate.
y=$(shuf -i 0-$MAXY -n 1)
wtp $x $y $WW $WH $wid wtp $x $y $WW $WH $wid
done done
sleep $FREQ sleep $FREQ

View file

@ -4,14 +4,24 @@
. /tmp/wms_var . /tmp/wms_var
KBRELOAD="pkill -usr1 -x sxhkd" # keybindings reload # keybindings reload.
LOCK="slock" # lock screen monitor KBRELOAD="pkill -usr1 -x sxhkd"
MOFF="xset dpms force off" # poweroff monitor # lock screen monitor.
SP="doas zzz -z" # suspend to RAM LOCK="slock"
HB="doas zzz -Z" # hibernate # poweroff monitor.
RB="doas shutdown -r now" # reboot MOFF="xset dpms force off"
POFF="doas shutdown -h now" # poweroff # suspend to ram.
EXIT="pkill sxhkd; pkill wew" # exit session SP="doas zzz -z"
# hibernate.
HB="doas zzz -Z"
# reboot.
RB="doas shutdown -r now"
# poweroff.
POFF="doas shutdown -h now"
# exit session.
EXIT="pkill wew"
# litle menu.
PROMPT="reload-key\nlock\nmonitor-off\nhalt\nreboot\nsuspend\nhibernate\nexit" PROMPT="reload-key\nlock\nmonitor-off\nhalt\nreboot\nsuspend\nhibernate\nexit"
option=`echo $PROMPT | $XMENU` option=`echo $PROMPT | $XMENU`

View file

@ -4,9 +4,12 @@
. /tmp/wms_var . /tmp/wms_var
FLAG=$1 # input FLAG=$1
FW=$(pfw) # focused window id # focused window id.
AMW=$(lsw) # all maped windows FW=$(pfw)
# all maped windows.
AMW=$(lsw)
# names file path.
NAMES="$HOME/.config/wms/wms_names" NAMES="$HOME/.config/wms/wms_names"
usage() { usage() {
@ -54,15 +57,20 @@ del_all() {
# togle groups # togle groups
togle() { togle() {
herds=$(atomx WM_HERD $(lsw -a) | cut -d ' ' -f1 | sort -u) # herds # herds.
if [ -n "$herds" ]; then # check if any herd exist herds=$(atomx WM_HERD $(lsw -a) | cut -d ' ' -f1 | sort -u)
h_target=$(printf "$herds" | $XMENU) # select herd target # check if any herd exist.
wind_to_map=$(atomx WM_HERD $(lsw -u) | grep $h_target | cut -d ' ' -f2) # windows to map if [ -n "$herds" ]; then
wind_to_unmap=$(atomx WM_HERD $(lsw) | grep -v $h_target | cut -d ' ' -f2) # windows to unmap # select herd target.
h_target=$(printf "$herds" | $XMENU)
# windwos to map.
wind_to_map=$(atomx WM_HERD $(lsw -u) | grep $h_target | cut -d ' ' -f2)
# windows to unmap.
wind_to_unmap=$(atomx WM_HERD $(lsw) | grep -v $h_target | cut -d ' ' -f2)
# do it.
mapw -m $wind_to_map & mapw -u $wind_to_unmap mapw -m $wind_to_map & mapw -u $wind_to_unmap
fi fi
} }
case $FLAG in case $FLAG in
-a) -a)

View file

@ -4,12 +4,16 @@
. /tmp/wms_var . /tmp/wms_var
AMW=$(lsw) # all maped windows # all maped widnows.
AMW=$(lsw)
# delay.
DELAY=.2 DELAY=.2
# if any maped window exist.
if [ -n "$AMW" ]; then if [ -n "$AMW" ]; then
# print id, class and name in xmenu.
TARGET=$(\ TARGET=$(\
for wid in $(lsw); do # print id, class and name in xmenu for wid in $(lsw); do
printf '%s\n' "$wid | $(atomx WM_CLASS $wid) | $(wname $wid)" printf '%s\n' "$wid | $(atomx WM_CLASS $wid) | $(wname $wid)"
done | cut -c 1-100 | $XMENU | cut -d '|' -f 1) done | cut -c 1-100 | $XMENU | cut -d '|' -f 1)

View file

@ -4,11 +4,14 @@
. /tmp/wms_var . /tmp/wms_var
TARGET=$(pfw) # focused window # focused windows.
TARGET=$(pfw)
# names file path.
NAMES="$HOME/.config/wms/wms_names" NAMES="$HOME/.config/wms/wms_names"
if [ "$(atomx WM_CLASS $TARGET)" = "$TERMINAL" ]; then # if any terminal is focused # if any terminal is focused.
atomx WM_NAME="$($XMENU < $NAMES)" $TARGET # change atom name if [ "$(atomx WM_CLASS $TARGET)" = "$TERMINAL" ]; then
# change atom name.
atomx WM_NAME="$($XMENU < $NAMES)" $TARGET
fi fi

View file

@ -4,12 +4,15 @@
. /tmp/wms_var . /tmp/wms_var
TNAME=$(echo $TERMINAL | cut -d ' ' -f 1) # terminal name # terminal name.
TNAME=$(echo $TERMINAL | cut -d ' ' -f 1)
# print all windows, filter and target the first in stack.
TARGET=$( TARGET=$(
for wid in $(lsw); do # print all windows, filter and target the first in stack for wid in $(lsw); do
printf '%s\n' "$wid $(atomx WM_CLASS $wid)" printf '%s\n' "$wid $(atomx WM_CLASS $wid)"
done | grep "$TNAME" | cut -d ' ' -f 1 | head -n 1) done | grep "$TNAME" | cut -d ' ' -f 1 | head -n 1)
wms_mainrole.sh $TARGET # focus terminal # focus terminal.
wms_mainrole.sh $TARGET

View file

@ -4,14 +4,21 @@
. /tmp/wms_var . /tmp/wms_var
FLAG=$1 # input FLAG=$1
RID=$(lsw -r) # root window id # root window id.
FW=$(pfw) # focused window RID=$(lsw -r)
CMW=$(lsw | wc -l) # count maped windows # focused window.
RW=$(wattr w $RID) # root width FW=$(pfw)
RH=$(wattr h $RID) # root height # count maped windows.
SW=$((RW - 2 * BW)) # usable screen width CMW=$(lsw | wc -l)
SH=$((RH - 2 * BW)) # usable screen height # root width.
RW=$(wattr w $RID)
# root height.
RH=$(wattr h $RID)
# usable screen width.
SW=$((RW - 2 * BW))
# usable screen height.
SH=$((RH - 2 * BW))
usage() { usage() {
cat<<EOF cat<<EOF
@ -32,18 +39,30 @@ monocule() {
# tiling. Master and stack # tiling. Master and stack
tiling() { tiling() {
sw=$((RW - 2 * GAP - 2 * BW)) # screen widht width gaps added # screen widht width gaps added.
msh=$((RH - 2 * GAP - 2 * BW)) # master screen height sw=$((RW - 2 * GAP - 2 * BW))
ssh=$((RH - GAP)) # stack screen height ((- BW))? # master screen height.
swcount=$((CMW - 1)) # stack windows count msh=$((RH - 2 * GAP - 2 * BW))
mwidth=$((sw * MP / 100 - 2 * BW)) # master area width # stack screen height (( - BW))?
mheight=$msh # master area height ssh=$((RH - GAP))
mx=$GAP # master x coordinate # stack windows count.
my=$GAP # master y coordinate swcount=$((CMW - 1))
swidth=$((sw - mwidth - GAP - 2 * BW)) # stack width # master area width.
sheight=$((ssh / swcount - GAP - 2 * BW)) # stack height mwidth=$((sw * MP / 100 - 2 * BW))
sx=$((mwidth + 2 * GAP + 2 * BW)) # stack x coordinate # master area height.
sy=$GAP # stack y coordinate mheight=$msh
# master X coordinate.
mx=$GAP
# master Y coordinate.
my=$GAP
# stack width.
swidth=$((sw - mwidth - GAP - 2 * BW))
# stack height.
sheight=$((ssh / swcount - GAP - 2 * BW))
# stack x coordinate.
sx=$((mwidth + 2 * GAP + 2 * BW))
# stack y coordinate.
sy=$GAP
# put focused window as master # put focused window as master
wtp $mx $my $mwidth $mheight $FW wtp $mx $my $mwidth $mheight $FW
@ -51,28 +70,38 @@ tiling() {
# put the rest of the windows in stack # put the rest of the windows in stack
for wid in $(lsw | grep -v $FW); do for wid in $(lsw | grep -v $FW); do
wtp $sx $sy $swidth $sheight $wid wtp $sx $sy $swidth $sheight $wid
sy=$((sy + sheight + GAP + 2 * BW)) # incremental stack y coordinate # incremental stack Y coordinate.
sy=$((sy + sheight + GAP + 2 * BW))
done done
} }
# widespread # widespread
widespread() { widespread() {
ww=$((SW * WP / 100)) # windows width # windows width.
wh=$((SH * WP / 100)) # windows height ww=$((SW * WP / 100))
x=$(((RW - ww) / (CMW * 2))) # initial X coordinate # windows height.
y=$(((RH - wh) / (CMW * 2))) # initial Y coordinate wh=$((SH * WP / 100))
xmax=$(((RW - ww) / CMW)) # function X value # initial X coordinate.
ymax=$(((RH - wh) / CMW)) # function Y value x=$(((RW - ww) / (CMW * 2)))
# initial Y coordinate.
y=$(((RH - wh) / (CMW * 2)))
# function X value.
xmax=$(((RW - ww) / CMW))
# function Y value.
ymax=$(((RH - wh) / CMW))
# put windows in cascade # put windows in cascade
for wid in $(lsw); do for wid in $(lsw); do
wtp $x $y $ww $wh $wid wtp $x $y $ww $wh $wid
x=$((x + xmax)) # incremental X value # incremental X value.
y=$((y + ymax)) # incremental Y value x=$((x + xmax))
# incremental Y value.
y=$((y + ymax))
done done
} }
if [ -n "$FW" ]; then # if there is a focused window # if there is a focused window.
if [ -n "$FW" ]; then
case $FLAG in case $FLAG in
-m) -m)
monocule monocule

View file

@ -8,10 +8,13 @@ else
. /tmp/wms_var . /tmp/wms_var
fi fi
FLAG=$1 # input FLAG=$1
RID=$(lsw -r) # root window id # root window id.
FW=$(pfw) # focused window RID=$(lsw -r)
WMSVAR="/tmp/wms_var" # variable temporary file # focused window.
FW=$(pfw)
# variable temporary file.
WMSVAR="/tmp/wms_var"
usage() { usage() {
cat<<EOF cat<<EOF
@ -29,20 +32,23 @@ wms_revalue.sh [ -b, -B, -d, -g, -G, -m, -M, -w, -W]
EOF EOF
} }
# increase border. (+2 pixels)
border_inc() { border_inc() {
if [ $BW -le 10 ]; then if [ $BW -le 10 ]; then
sed -i "s/^.*\bBW=\b.*$/BW=$((BW + 2))/" $WMSVAR sed -i "s/^.*\bBW=\b.*$/BW=$((BW + 2))/" $WMSVAR
wms_mainrole.sh $FW wms_mainrole.sh $FW
fi fi
} # +2 pixel calculation }
# decrease border. (-2 pixels)
border_dec() { border_dec() {
if [ $BW -ge 4 ]; then if [ $BW -ge 4 ]; then
sed -i "s/^.*\bBW=\b.*$/BW=$((BW - 2))/" $WMSVAR sed -i "s/^.*\bBW=\b.*$/BW=$((BW - 2))/" $WMSVAR
wms_mainrole.sh $FW wms_mainrole.sh $FW
fi fi
} # -2 pixel calculation }
# increase gaps. (+2 pixels)
gap_inc() { gap_inc() {
if [ $GAP -le 40 ]; then if [ $GAP -le 40 ]; then
sed -i "s/^.*\bGAP=\b.*$/GAP=$((GAP + 2))/" $WMSVAR sed -i "s/^.*\bGAP=\b.*$/GAP=$((GAP + 2))/" $WMSVAR
@ -50,6 +56,7 @@ gap_inc() {
fi fi
} }
# decrease gaps. (-2 pixels)
gap_dec() { gap_dec() {
if [ $GAP -ge 2 ]; then if [ $GAP -ge 2 ]; then
sed -i "s/^.*\bGAP=\b.*$/GAP=$((GAP - 2))/" $WMSVAR sed -i "s/^.*\bGAP=\b.*$/GAP=$((GAP - 2))/" $WMSVAR
@ -57,61 +64,65 @@ gap_dec() {
fi fi
} }
# increase master area. (+5 pixels)
master_inc() { master_inc() {
if [ $MP -le 80 ]; then if [ $MP -le 80 ]; then
sed -i "s/^.*\bMP=\b.*$/MP=$((MP + 5))/" $WMSVAR sed -i "s/^.*\bMP=\b.*$/MP=$((MP + 5))/" $WMSVAR
wms_usher.sh -t wms_usher.sh -t
fi fi
} # 5% + calculation }
# decrease master area. (-5 pixels)
master_dec() { master_dec() {
if [ $MP -ge 20 ]; then if [ $MP -ge 20 ]; then
sed -i "s/^.*\bMP=\b.*$/MP=$((MP - 5))/" $WMSVAR sed -i "s/^.*\bMP=\b.*$/MP=$((MP - 5))/" $WMSVAR
wms_usher.sh -t wms_usher.sh -t
fi fi
} # 5% - calculation }
# increase window percentage. (+5 %)
windowperc_inc() { windowperc_inc() {
if [ $WP -le 90 ]; then if [ $WP -le 90 ]; then
sed -i "s/^.*\bWP=\b.*$/WP=$((WP + 5))/" $WMSVAR sed -i "s/^.*\bWP=\b.*$/WP=$((WP + 5))/" $WMSVAR
wms_usher.sh -w wms_usher.sh -w
fi fi
} # 5% + calculation }
# decrease window percentage. (-5 %)
windowperc_dec() { windowperc_dec() {
if [ $WP -ge 60 ]; then if [ $WP -ge 60 ]; then
sed -i "s/^.*\bWP=\b.*$/WP=$((WP - 5))/" $WMSVAR sed -i "s/^.*\bWP=\b.*$/WP=$((WP - 5))/" $WMSVAR
wms_usher.sh -w wms_usher.sh -w
fi fi
} # 5% - calculation }
if [ -n "$FLAG" ]; then if [ -n "$FLAG" ]; then
case $FLAG in case $FLAG in
-b) # decrease border width -b)
border_dec border_dec
;; ;;
-B) # increase border width -B)
border_inc border_inc
;; ;;
-d) # load defaults -d) # load defaults
cp $HOME/.config/wms/wms_var /tmp/wms_var cp $HOME/.config/wms/wms_var /tmp/wms_var
;; ;;
-g) # decrease gaps -g)
gap_dec gap_dec
;; ;;
-G) # increase gaps -G)
gap_inc gap_inc
;; ;;
-m) # reduce tiling master area -m)
master_dec master_dec
;; ;;
-M) # increase tiling master area -M)
master_inc master_inc
;; ;;
-w) # reduce window size -w)
windowperc_dec windowperc_dec
;; ;;
-W) # increase window size -W)
windowperc_inc windowperc_inc
;; ;;
*) *)