unified general variables.

This commit is contained in:
#root_informatica 2024-09-11 23:09:40 -03:00
parent 1f7be225a1
commit d51f416dd9
11 changed files with 31 additions and 222 deletions

View file

@ -1,24 +1,36 @@
# terminal
# terminal.
TERMINAL="xterm"
# menu command
# menu command.
XMENU=xmenu.sh
# border width
BW=2
# active color
AC=B6B6B6
AC=B2AA8E
# inactive color
IC=616161
IC=393128
# background color.
BC=101010
# border width.
BW=2
# windows percentage
WP=90
# gaps
WP=94
# master area percentage.
MP=60
# gaps.
GAP=6
# focused window.
FW=$(pfw)
# all maped windows.
AMW=$(lsw)
# root window id.
RID=$(lsw -r)
# root window width.
RW=$(wattr w $RID)
# root window height.
RH=$(wattr h $RID)
# screen utilizable width.
SW=$((RW - 2 * BW))
# screen utilizable height.
SH=$((RH -2 * BW))

View file

@ -4,23 +4,9 @@
## it depends of wms_focuser.sh ##
# wms_backgroundize.sh by @root_informatica.
. /tmp/wms_var
. $HOME/.config/wms/wms_var
FLAG=$1
# focused window.
FW=$(pfw)
# root window id.
RID=$(lsw -r)
# background window id.
BID=$(lsw -o)
# 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
background() {

View file

@ -1,31 +0,0 @@
#!/bin/sh
## clean screen ##
# wms_clearer.sh by @root_informatica.
. /tmp/wms_var
FLAG=$1
# fucused window.
FW=$(pfw)
# clearer atom.
CL=$(atomx WM_CL $FW)
# all maped windows.
AMW=$(lsw)
# unmaped widnows.
UW=$(atomx WM_CL $(lsw -u))
# if unmaped windows exist.
if [ -n "$UW" ]; then
# map them.
mapw -m $UW
# delete atom.
atomx -d WM_CL $UW
else # if no unmaped windows
# unmaped them and create atom.
for wid in $(lsw); do
atomx WM_CL=$wid $wid
done
mapw -u $AMW
fi

View file

@ -6,24 +6,8 @@
. $HOME/.config/wms/wms_var
FLAG=$1
# root window id.
RID=$(lsw -r)
# focused window.
FW=$(pfw)
# count maped windows.
CMW=$(lsw | wc -l)
# 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))
# master area percentage.
MP=60
# gaps.
GAP=6
usage() {
cat<<EOF

View file

@ -3,15 +3,10 @@
## sort windows by herds/flock ##
# wms_shepperd.sh by @root_informatica.
. ~/.config/wms/wms_var
. $HOME/.config/wms/wms_var
. $HOME/.config/wms/wms_names
FLAG=$1
# focused window id.
FW=$(pfw)
# all maped windows.
AMW=$(lsw)
# names file path.
NAMES="$HOME/.config/wms/wms_names"
usage() {
cat<<EOF

View file

@ -5,8 +5,6 @@
. $HOME/.config/wms/wms_var
# all maped widnows.
AMW=$(lsw)
# delay.
DELAY=.2

View file

@ -3,16 +3,12 @@
## rename terminals ##
# wms_termrename.sh by @root_informatica.
. /tmp/wms_var
# focused windows.
TARGET=$(pfw)
# names file path.
NAMES="$HOME/.config/wms/wms_names"
. $HOME/.config/wms/wms_var
. $HOME/.config/wms/wms_names
# if any terminal is focused.
if [ "$(atomx WM_CLASS $TARGET)" = "$TERMINAL" ]; then
# change atom name.
atomx WM_NAME="$($XMENU < $NAMES)" $TARGET
atomx WM_NAME="$($XMENU < $NAMES)" $FW
fi

View file

@ -4,7 +4,6 @@
# wms_toggle.sh by @root_informatica.
FLAG=$1
FW=$(pfw)
usage() {
cat<<EOF

View file

@ -1,116 +0,0 @@
#!/bin/sh
# check if there is variable file in /tmp for source. if it's not there, copy it ##
# wms_value.sh by @root_informatica.
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
# root window id.
RID=$(lsw -r)
# focused window.
FW=$(pfw)
# variable temporary file.
WMSVAR="/tmp/wms_var"
usage() {
cat<<EOF
usage:
wms_revalue.sh [ -b, -B, -d, -g, -G, -m, -M, -w, -W]
-d) load default
-g) minimize gaps
-G) maximize
-m) minimize tiling master area
-M) maximize tiling master area
-w) minimize window percentage
-W) maximize window percentage
EOF
}
# default values.
default() {
# copy wms_var file in /tmp.
cp $HOME/.config/wms/wms_var /tmp/wms_var
# give some name to the window manager.
atomx WM_NAME=wms $(lsw -r) > /dev/null
}
# increase gaps. (+2 pixels)
gap_inc() {
if [ $GAP -le 40 ]; then
sed -i "s/^.*\bGAP=\b.*$/GAP=$((GAP + 2))/" $WMSVAR
wms_usher.sh -t
fi
}
# decrease gaps. (-2 pixels)
gap_dec() {
if [ $GAP -ge 2 ]; then
sed -i "s/^.*\bGAP=\b.*$/GAP=$((GAP - 2))/" $WMSVAR
wms_usher.sh -t
fi
}
# increase master area. (+5 pixels)
master_inc() {
if [ $MP -le 80 ]; then
sed -i "s/^.*\bMP=\b.*$/MP=$((MP + 5))/" $WMSVAR
wms_usher.sh -t
fi
}
# decrease master area. (-5 pixels)
master_dec() {
if [ $MP -ge 20 ]; then
sed -i "s/^.*\bMP=\b.*$/MP=$((MP - 5))/" $WMSVAR
wms_usher.sh -t
fi
}
# increase window percentage. (+5 %)
windowperc_inc() {
if [ $WP -le 90 ]; then
sed -i "s/^.*\bWP=\b.*$/WP=$((WP + 5))/" $WMSVAR
wms_usher.sh -w
fi
}
# decrease window percentage. (-5 %)
windowperc_dec() {
if [ $WP -ge 60 ]; then
sed -i "s/^.*\bWP=\b.*$/WP=$((WP - 5))/" $WMSVAR
wms_usher.sh -w
fi
}
case $FLAG in
-d)
default
;;
-g)
gap_dec
;;
-G)
gap_inc
;;
-m)
master_dec
;;
-M)
master_inc
;;
-w)
windowperc_dec
;;
-W)
windowperc_inc
;;
*)
usage
;;
esac

View file

@ -6,8 +6,6 @@
. $HOME/.config/wms/wms_var
FLAG=$1
# focused window.
FW=$(pfw)
usage() {
cat<<EOF

View file

@ -6,18 +6,6 @@
. $HOME/.config/wms/wms_var
FLAG=$1
# focused window id.
FW=$(pfw)
# root window id.
RID=$(lsw -r)
# root window width.
RW=$(wattr w $RID)
# root window height.
RH=$(wattr h $RID)
# screen utilizable width.
SW=$((RW - 2 * BW))
# screen utilizable height.
SH=$((RH - 2 * BW))
usage() {
cat<<EOF