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
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
done
else
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
done
fi
@ -82,12 +82,12 @@ volume()
{
if [[ $1 ]]; then
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
done
else
while :; do
printf 'V%s\n' " $(pamixer --get-volume-human) "
printf 'V%s\n' " Vol: $(pamixer --get-volume-human) ${separator}"
sleep 0.2
done
fi
@ -106,20 +106,20 @@ network()
if [[ $1 ]]; then
until check; do
printf 'N%s\n' "%{A1:$1:} disconnected %{A}"
printf 'N%s\n' "%{A1:$1:} disconnected %{A}${separator}"
sleep 5
done
while :; do
printf 'N%s\n' "%{A1:$1:} connected %{A}"
printf 'N%s\n' "%{A1:$1:} connected %{A}${separator}"
sleep 100
done
else
until check; do
printf 'N%s\n' " disconnected %{A}"
printf 'N%s\n' " disconnected %{A}${separator}"
sleep 5
done
while :; do
printf 'N%s\n' " connected %{A}"
printf 'N%s\n' " connected %{A}${separator}"
sleep 100
done
fi
@ -127,7 +127,7 @@ network()
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
case $line in
@ -135,7 +135,7 @@ parsefifo()
V*) vol="${line#?}" ;;
B*) bat="${line#?}" ;;
N*) net="${line#?}" ;;
A*) title="${line#?}" title="${title:0:50}";;
A*) title="${line#?}"; title="${title:0:50}";;
L*) l="${line#?}"; layout="${layouts[$l]}" ;;
W*)
wm='' IFS=':' # set the internal field separator to ':'
@ -152,7 +152,7 @@ parsefifo()
done
;;
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
}
@ -168,7 +168,7 @@ mkfifo "$fifo"
# 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
# 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" &
battery '' > "$fifo" &
volume 'pavucontrol' > "$fifo" &