make statusbar actually useable

This commit is contained in:
randomuser 2022-07-04 12:38:02 -05:00
parent 779a510f9c
commit f18f974a35
1 changed files with 9 additions and 11 deletions

View File

@ -33,8 +33,8 @@ mod_vol () {
[ "$ss" = "alsa" ] && amixer | grep '^ Front' | awk -F'[' '{ORS = ""; print "av" substr($2, 1, 3); exit}' [ "$ss" = "alsa" ] && amixer | grep '^ Front' | awk -F'[' '{ORS = ""; print "av" substr($2, 1, 3); exit}'
} }
mod_hello () { mod_date_time () {
printf "HJi there" date '+%m%d-%H:%M' | tr '\n' ' '
} }
update_mod () { update_mod () {
@ -47,8 +47,8 @@ get_mod () {
} }
echo_bar () { echo_bar () {
left="$(get_mod "power") $(get_mod "vol") $(get_mod "bspwm")" left="$(get_mod "bspwm")"
right="$(get_mod "hello")" right="$(get_mod "date_time") $(get_mod "power") $(get_mod "vol")"
width="$(tput cols)" width="$(tput cols)"
rightwidth="${#right}" rightwidth="${#right}"
@ -69,20 +69,18 @@ update_all () {
update_mod power update_mod power
update_mod vol update_mod vol
update_mod bspwm update_mod bspwm
update_mod date_time
} }
tput civis tput civis
register_sigs register_sigs
update_all
update_mod power
update_mod vol
update_mod hello
update_mod bspwm
i=0 i=0
while true; do while true; do
sleep 1 sleep 0.25
[ "$i" -eq 29 ] && update_all && i=0 [ "$i" -eq $((29 * 4)) ] && update_all && i=0
echo_bar echo_bar
i="$(($i + 1))"
done done