commit 6f6f6df95a494cc41b90f448cc8efc580a7f0054
parent 22677e9b86fac102fa3ef8309bb4790dca1831a0
Author: Alexander Balgavy <alexander.balgavy@spaceapplications.com>
Date: Fri, 27 Oct 2023 20:20:26 +0200
dwmblocks: scripts updates
Diffstat:
4 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/scripts/dwmblock-brightness b/scripts/dwmblock-brightness
@@ -2,18 +2,17 @@
# dwmblocks script for brightness information
case "$BUTTON" in
1)
- pgrep -f backlight-brightness || setsid -f "$TERMINAL" -e backlight-brightness
pkill -RTMIN+3 dwmblocks;;
- 3) backlight-brightness -s 100 ;;
+ 3) brightnessctl set '100%';;
4)
- backlight-brightness '-10'
+ brightnessctl set '10%-'
pkill -RTMIN+3 dwmblocks
;;
5)
- backlight-brightness '+20'
+ brightnessctl set '10%+'
pkill -RTMIN+3 dwmblocks
;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
-paste -d '/' /sys/class/backlight/*/actual_brightness /sys/class/backlight/*/max_brightness
+printf ' %s' "$(brightnessctl --machine-readable | cut -d, -f4)"
diff --git a/scripts/dwmblock-cpu b/scripts/dwmblock-cpu
@@ -35,5 +35,5 @@ echo "$stats" | while read -r row; do
"7") printf "█";;
"8") printf "█";;
esac
-done; printf "\\n"
+done
echo "$stats" > "$cache"
diff --git a/scripts/dwmblock-emacs-org-clock b/scripts/dwmblock-emacs-org-clock
@@ -5,6 +5,6 @@ case "$BUTTON" in
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
-if pgrep -f emacs >/dev/null 2>&1 && command -v emacsclient >/dev/null 2>&1; then
+if pgrep -xl emacs >/dev/null 2>&1 && command -v emacsclient >/dev/null 2>&1; then
printf " 🕛 %.40s" "$(emacsclient -e '(if (org-clock-is-active) (substring-no-properties (org-clock-get-clock-string)) "")' | tr -d '"')"
fi
diff --git a/scripts/dwmblock-internet b/scripts/dwmblock-internet
@@ -6,7 +6,7 @@
# Interfaces:
# (list with `nmcli --get-values GENERAL.DEVICE,GENERAL.TYPE device show`)
-wired=enp0s31f6
+wired=enxc84bd604a6e7
wireless=wlp0s20f3
# there's probably a way to change these but I'd have to know all files to update...
@@ -14,12 +14,20 @@ case "$BUTTON" in
1)
pgrep -f nmtui || "$TERMINAL" -e nmtui
pkill -RTMIN+5 dwmblocks ;;
- 3) notify "Connected to $(/sbin/iwgetid -r)" '' ;;
+ 2) notify "Connected to $(/sbin/iwgetid -r)" '' ;;
+ 3) notify Wireless "Toggling wireless..."
+ rfkill toggle wlan
+ pkill -RTMIN+5 dwmblocks ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
case "$(cat /sys/class/net/$wireless/operstate 2>/dev/null)" in
- down) wifiicon="📡 " ;;
+ down)
+ if rfkill list wlan | grep 'Soft blocked: no' >/dev/null 2>&1; then
+ wifiicon="📡 "
+ else
+ wifiicon="📡🛑 "
+ fi ;;
up) wifiicon="$(awk -v pat="^\\s*$wireless" '$0 ~ pat { print "📶", int($3) "% " }' /proc/net/wireless)" ;;
# might need to do some calculations if this doesn't match up with `iwconfig` link quality
# up) wifiicon="$(awk '/^\s*e/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;;