Update dk bar

This commit is contained in:
natemaia 2022-08-20 12:44:07 -07:00
parent d48b938b4c
commit dfcd3b938a

View File

@ -67,12 +67,12 @@ battery()
{ {
if [[ $1 ]]; then if [[ $1 ]]; then
while :; do while :; do
printf 'B%s\n' "%{A1:$1:} $(acpi --battery 2>/dev/null | cut -d, -f2 | tr -d '[:space:]') %{A}" printf 'B%s\n' "%{A1:$1:} Bat: $(acpi --battery 2>/dev/null | grep -v 'Unknown\| 0%' | cut -d, -f2 | tr -d '[:space:]') %{A}${separator}"
sleep 10 sleep 10
done done
else else
while :; do while :; do
printf 'B%s\n' " $(acpi --battery 2>/dev/null | cut -d, -f2 | tr -d '[:space:]') " printf 'B%s\n' " Bat: $(acpi --battery 2>/dev/null | grep -v 'Unknown\| 0%' | cut -d, -f2 | tr -d '[:space:]') ${separator}"
sleep 10 sleep 10
done done
fi fi
@ -82,12 +82,12 @@ volume()
{ {
if [[ $1 ]]; then if [[ $1 ]]; then
while :; do while :; do
printf 'V%s\n' "%{A1:$1:} $(pamixer --get-volume-human) %{A}" printf 'V%s\n' "%{A1:$1:} Vol: $(pamixer --get-volume-human) %{A}${separator}"
sleep 0.2 sleep 0.2
done done
else else
while :; do while :; do
printf 'V%s\n' " $(pamixer --get-volume-human) " printf 'V%s\n' " Vol: $(pamixer --get-volume-human) ${separator}"
sleep 0.2 sleep 0.2
done done
fi fi
@ -106,20 +106,20 @@ network()
if [[ $1 ]]; then if [[ $1 ]]; then
until check; do until check; do
printf 'N%s\n' "%{A1:$1:} disconnected %{A}" printf 'N%s\n' "%{A1:$1:} disconnected %{A}${separator}"
sleep 5 sleep 5
done done
while :; do while :; do
printf 'N%s\n' "%{A1:$1:} connected %{A}" printf 'N%s\n' "%{A1:$1:} connected %{A}${separator}"
sleep 100 sleep 100
done done
else else
until check; do until check; do
printf 'N%s\n' " disconnected %{A}" printf 'N%s\n' " disconnected %{A}${separator}"
sleep 5 sleep 5
done done
while :; do while :; do
printf 'N%s\n' " connected %{A}" printf 'N%s\n' " connected %{A}${separator}"
sleep 100 sleep 100
done done
fi fi
@ -127,7 +127,7 @@ network()
parsefifo() parsefifo()
{ {
typeset f='' b='' u='' wm='' time='' net='' bat='' vol='' title='' layout='' s="$separator" typeset f='' b='' u='' wm='' time='' net='' bat='' vol='' title='' layout=''
while read -r line; do while read -r line; do
case $line in case $line in
@ -135,7 +135,7 @@ parsefifo()
V*) vol="${line#?}" ;; V*) vol="${line#?}" ;;
B*) bat="${line#?}" ;; B*) bat="${line#?}" ;;
N*) net="${line#?}" ;; N*) net="${line#?}" ;;
A*) title="${line#?}" title="${title:0:50}";; A*) title="${line#?}"; title="${title:0:50}";;
L*) l="${line#?}"; layout="${layouts[$l]}" ;; L*) l="${line#?}"; layout="${layouts[$l]}" ;;
W*) W*)
wm='' IFS=':' # set the internal field separator to ':' wm='' IFS=':' # set the internal field separator to ':'
@ -152,7 +152,7 @@ parsefifo()
done done
;; ;;
esac esac
printf "%s\n" "%{l}$wm $s $layout%{c}$title%{r}${net}${s}${bat}${s}${vol}${s}${time}" printf "%s\n" "%{l}$wm $separator $layout%{c}$title%{r}${net}${bat}${vol}${time}"
done done
} }
@ -168,7 +168,7 @@ mkfifo "$fifo"
# here we dump info into the FIFO, order does not matter things are parsed # here we dump info into the FIFO, order does not matter things are parsed
# out using the first character of the line. Click commands for left button # out using the first character of the line. Click commands for left button
# can be added by passing an argument containing the command (like volume below) # can be added by passing an argument containing the command (like volume below)
network 'xterm -e nmtui-connect' > "$fifo" & network 'al-terminal -e nmtui-connect' > "$fifo" &
clock 'gsimplecal' > "$fifo" & clock 'gsimplecal' > "$fifo" &
battery '' > "$fifo" & battery '' > "$fifo" &
volume 'pavucontrol' > "$fifo" & volume 'pavucontrol' > "$fifo" &