diff --git a/.local/bin/daemons/remapd b/.local/bin/daemons/remapd new file mode 100755 index 00000000..71df8b96 --- /dev/null +++ b/.local/bin/daemons/remapd @@ -0,0 +1,6 @@ +#!/bin/sh +while : ; do + dmesg -W -f kern | grep "input:" -q + sleep 1 + remaps-dvorak +done diff --git a/.local/bin/daemons/sbd-battery b/.local/bin/daemons/sbd-battery new file mode 100755 index 00000000..222129de --- /dev/null +++ b/.local/bin/daemons/sbd-battery @@ -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 diff --git a/.local/bin/daemons/sbd-music b/.local/bin/daemons/sbd-music new file mode 100755 index 00000000..e7181cda --- /dev/null +++ b/.local/bin/daemons/sbd-music @@ -0,0 +1,4 @@ +#!/bin/sh +while : ; do + mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks || break +done diff --git a/.local/bin/daemons/sbd-playerctl b/.local/bin/daemons/sbd-playerctl new file mode 100755 index 00000000..84887017 --- /dev/null +++ b/.local/bin/daemons/sbd-playerctl @@ -0,0 +1,2 @@ +#!/bin/sh +playerctl status -F | (while read -r _; do pkill -RTMIN+11 dwmblocks; done;) diff --git a/.local/bin/statusbar/sb-battery b/.local/bin/statusbar/sb-battery index 1bd3f361..b0fcb186 100755 --- a/.local/bin/statusbar/sb-battery +++ b/.local/bin/statusbar/sb-battery @@ -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 diff --git a/.local/bin/statusbar/sb-internet b/.local/bin/statusbar/sb-internet index 58c4cd23..7a5abf6f 100755 --- a/.local/bin/statusbar/sb-internet +++ b/.local/bin/statusbar/sb-internet @@ -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" diff --git a/.local/bin/statusbar/sbd-music b/.local/bin/statusbar/sbd-music deleted file mode 100755 index b573d39f..00000000 --- a/.local/bin/statusbar/sbd-music +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -while : ; do - mpc idle >/dev/null && pkill -RTMIN+11 dwmblocks || break -done diff --git a/.local/bin/statusbar/sbd-playerctl b/.local/bin/statusbar/sbd-playerctl deleted file mode 100755 index 697e5e3d..00000000 --- a/.local/bin/statusbar/sbd-playerctl +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -playerctl status -F | tee "/tmp/playerctl-status" | (while read -r _; do pkill -RTMIN+11 dwmblocks; done;)