1
0
Fork 0

improve status bar scripts

This commit is contained in:
Luca Bilke 2023-02-06 22:22:50 +01:00
parent 8e941231bc
commit 10c2fdd721
8 changed files with 34 additions and 22 deletions

6
.local/bin/daemons/remapd Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
while : ; do
dmesg -W -f kern | grep "input:" -q
sleep 1
remaps-dvorak
done

6
.local/bin/daemons/sbd-battery Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
# battery status file is sent in as an argument from sb-battery
while inotifywait -e modify "$1/status"; do
pkill -RTMIN+3 dwmblocks || break
done

4
.local/bin/daemons/sbd-music Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
while : ; do
mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks || break
done

View File

@ -0,0 +1,2 @@
#!/bin/sh
playerctl status -F | (while read -r _; do pkill -RTMIN+11 dwmblocks; done;)

View File

@ -6,6 +6,7 @@ green="\033[32m"
white="\033[37m"
reset="\033[0m"
for battery in /sys/class/power_supply/BAT?*; do
pidof -x sbd-battery >/dev/null 2>&1 || sbd-battery "$battery" >/dev/null 2>&1 &
[ -n "${capacity+x}" ] && printf " "
capacity="$(cat "$battery/capacity" 2>&1)"
case "$(cat "$battery/status" 2>&1)" in

View File

@ -1,29 +1,28 @@
#!/bin/sh
# FIX: Script dies when ethernet cable is plugged in through docking station
shift=""
if ls /sys/class/net/w*/operstate 1>/dev/null 2>&1; then
for w in /sys/class/net/w*/operstate; do
percent="$(cat /proc/net/wireless | grep "$(basename "$(dirname $w)")" | tr -s ' ' | cut -d ' ' -f3 | tr -dc "[:digit:]")"
grep -vxq '0x1003' && wifi_icon="" || wifi_icon="$(sed "s/up/直/;s/down/睊/" $w | tr -d "[:space:]")"
printf "$shift\033[11m%s\033[10m %s" "$wifi_icon" "$percent"
shift=" "
done
for w in /sys/class/net/w*/; do
percent="$(cat /proc/net/wireless | grep "$(basename "$(dirname $w/operstate)")" | tr -s ' ' | cut -d ' ' -f3 | tr -dc "[:digit:]")"
grep -vxq '0x1003' "$w/flags" && wifi_icon="" || wifi_icon="$(sed "s/up/直/;s/down/睊/" $w/operstate | tr -d "[:space:]")"
printf "$shift\033[11m%s\033[10m %s" "$wifi_icon" "$percent"
shift=" "
done
fi
if ls /sys/class/net/e*/operstate 1>/dev/null 2>&1; then
for e in /sys/class/net/e*/operstate; do
if_icon="$(sed "s/down//;s/up//" $e)"
printf "$shift\033[11m%s\033[10m" "$if_icon"
shift=" "
done
for e in /sys/class/net/e*/operstate; do
if_icon="$(sed "s/down//;s/up//" $e)"
printf "$shift\033[11m%s\033[10m" "$if_icon"
shift=" "
done
fi
if ls /sys/class/net/tun*/operstate 1>/dev/null 2>&1; then
for _ in /sys/class/net/tun*/operstate; do
printf "$shift\033[11m%s\033[10m" "嬨"
shift=" "
done
for _ in /sys/class/net/tun*/operstate; do
printf "$shift\033[11m%s\033[10m" "嬨"
shift=" "
done
fi
printf "\n"

View File

@ -1,4 +0,0 @@
#!/bin/sh
while : ; do
mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks || break
done

View File

@ -1,2 +0,0 @@
#!/bin/sh
playerctl status -F | tee "/tmp/playerctl-status" | (while read -r _; do pkill -RTMIN+11 dwmblocks; done;)