diff --git a/batlarm.sh b/batlarm.sh new file mode 100755 index 0000000..1093cf9 --- /dev/null +++ b/batlarm.sh @@ -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 diff --git a/wms_backgroundize.sh b/wms_backgroundize.sh index adef9c4..1e5a1af 100755 --- a/wms_backgroundize.sh +++ b/wms_backgroundize.sh @@ -6,31 +6,49 @@ . /tmp/wms_var FLAG=$1 -FW=$(pfw) # focused window -RID=$(lsw -r) # root widnow id -BID=$(lsw -o) # bachground window id -RW=$(wattr w $RID) # root width -RH=$(wattr h $RID) # root height -SW=$((RW - 2 * BW)) # usable screen width -SH=$((RH - 2 * BW)) # usable screen height +# 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() { - atomx WM_IGN="$(wattr xywh $FW) $FW" $FW # store size and place in atom - chwso -l $FW # put on bottom in window stack order - wtp 0 0 $SW $SH $FW # fullsize - ignw -s $FW # ignore focused window - chwb -c $BC $FW # change border color to ignore - wms_mainrole.sh -p # focus prev window + # store size and place of the focused widnow in atom. + atomx WM_IGN="$(wattr xywh $FW) $FW" $FW + # put it on bottom in window stack order. + chwso -l $FW + # make fullsize. + 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() { - ignw -r $BID # unignore - wtp $(atomx WM_IGN $BID) # restore size and place - chwso -r $BID # put on top in the window stack order - atomx -d WM_IGN $BID # delete atom - wms_mainrole.sh $BID # focus + # unignore. + ignw -r $BID + # restore size an d place. + wtp $(atomx WM_IGN $BID) + # 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 diff --git a/wms_clearer.sh b/wms_clearer.sh index dab7a90..b8df273 100755 --- a/wms_clearer.sh +++ b/wms_clearer.sh @@ -5,18 +5,26 @@ . /tmp/wms_var FLAG=$1 -FW=$(pfw) # focused window -CL=$(atomx WM_CL $FW) # clearrer atom -AMW=$(lsw) # all maped windows -UW=$(atomx WM_CL $(lsw -u)) # unmaped windows +# 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 [ -n "$UW" ]; then # if unmaped windows - mapw -m $UW # map them - atomx -d WM_CL $UW # delete atom +# 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 - for wid in $(lsw); do - atomx WM_CL=$wid $wid - done # create atom - mapw -u $AMW # unmap windows +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 diff --git a/wms_editor.sh b/wms_editor.sh index 6631de3..67304fb 100755 --- a/wms_editor.sh +++ b/wms_editor.sh @@ -5,10 +5,11 @@ . /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)" done | grep $XENAME | cut -d ' ' -f1) - +# if editor window is open, focus it; else, start editor. [ $TARGET ] && wms_mainrole.sh $TARGET \ || $XECMD diff --git a/wms_launcher.sh b/wms_launcher.sh index 6fd32b3..778c6a9 100755 --- a/wms_launcher.sh +++ b/wms_launcher.sh @@ -2,7 +2,6 @@ . /tmp/wms_var -$TERMINAL -name 'xlauncher' \ +$TERMINAL -name 'wms_launcher' \ -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' diff --git a/wms_mainrole.sh b/wms_mainrole.sh index ca66704..119b432 100755 --- a/wms_mainrole.sh +++ b/wms_mainrole.sh @@ -5,6 +5,7 @@ . /tmp/wms_var FLAG=$1 +# focused window. FW=$(pfw) usage() { @@ -62,6 +63,7 @@ esac # transfer focus wtf $wid -# set borders -chwb -s $BW -c $IC $(lsw | grep -v $(pfw)) # unfocused color -chwb -s $BW -c $AC $(pfw) # focused color +# set colors on the unfocused windows. +chwb -s $BW -c $IC $(lsw | grep -v $(pfw)) +# set colors on the focused widnow. +chwb -s $BW -c $AC $(pfw) diff --git a/wms_menu.sh b/wms_menu.sh index 5ac5c4d..87523bd 100755 --- a/wms_menu.sh +++ b/wms_menu.sh @@ -2,7 +2,6 @@ . /tmp/wms_var -$TERMINAL -name "xmenu" \ +$TERMINAL -name "wms_menu" \ -g $GEOMETRY \ - -bg "#$BC" \ -e "fzf --bind 'ctrl-e:print-query' --no-sort $* < /proc/$$/fd/0 > /proc/$$/fd/1" diff --git a/wms_mimic.sh b/wms_mimic.sh index 5367f93..2367699 100755 --- a/wms_mimic.sh +++ b/wms_mimic.sh @@ -1,10 +1,15 @@ #!/bin/sh -TMPIMG="/tmp/mimic.png" # temp image target -TMPCOL="/tmp/tmpcol" # temp extracted colors file -WMSVAR="$HOME/.config/wms/wms_var" # window manager variables -XVAR="$HOME/.Xresources" # default x variable file -NC="3" # number of colors to extract +# temp image target. +TMPIMG="/tmp/mimic.png" +# temp extracted colors file. +TMPCOL="/tmp/tmpcol" +# 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 import -w root $TMPIMG diff --git a/wms_moveresize.sh b/wms_moveresize.sh index 92a04bc..a10dbc4 100755 --- a/wms_moveresize.sh +++ b/wms_moveresize.sh @@ -4,13 +4,19 @@ . /tmp/wms_var -FLAG=$1 # flag -FW=$(pfw) # focused window id -RID=$(lsw -r) # root window id -RW=$(wattr w $RID) # root window width -RH=$(wattr h $RID) # root window heigth -SW=$((RW - 2 * BW - 2 * GAP)) # screen utilizable width -SH=$((RH - 2 * BW - 2 * GAP)) # screen utilizable height +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 - 2 * GAP)) +# screen utilizable height. +SH=$((RH - 2 * BW - 2 * GAP)) usage() { cat<