aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-06-06 23:42:59 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-06-06 23:42:59 +0200
commitc00b14c75468f7c91cb0e89de20d8433fba7c917 (patch)
treee2117c1037dd772734e81c956380f4023687799c
parent669b6b86a128f7559b257e69f07e610e26d0cd23 (diff)
downloadscripts-c00b14c75468f7c91cb0e89de20d8433fba7c917.tar.gz
scripts-c00b14c75468f7c91cb0e89de20d8433fba7c917.tar.bz2
scripts-c00b14c75468f7c91cb0e89de20d8433fba7c917.zip
update
-rwxr-xr-xpw-battery60
-rwxr-xr-xpw-cputemp (renamed from pw-systemstats)14
-rwxr-xr-xpw-date45
-rwxr-xr-xpw-fan10
-rwxr-xr-xpw-music30
-rwxr-xr-xpw-update-fingerprint2
6 files changed, 97 insertions, 64 deletions
diff --git a/pw-battery b/pw-battery
index 3f3dea7..bce03cc 100755
--- a/pw-battery
+++ b/pw-battery
@@ -1,28 +1,11 @@
-#!/bin/sh
+#!/usr/bin/env bash
+
# Display the current battery status.
# requires joypixels font in dwm config.def.h
-notify() {
- dunstify \
- -i battery-good-symbolic \
- -t 10000 \
- -h string:x-canonical-private-synchronous:battery \
- "Battery" "$1"
-}
-
-
-case "$BLOCK_BUTTON" in
- # ugly must do better
- 1)
- INF=$(inxi -B --extra 3 -c 0 -y 1)
- REM=$(acpi | cut -d , -f 3)
- DAT=$(echo "$INF$REM" | sed -e 's/^[ \t]*//')
- notify "$DAT"
- ;;
- 3)
- notify "$(acpi -b | awk -F ': |, ' '{printf "%s\n%s\n", $2, $4}')"
- ;;
-esac
+# This is updated by signal 2, so 2 + 34 =
+# kill -36 $(pidof dwmblocks) or
+# pkill -RTMIN+2 dwmblocks
# Loop through all attached batteries.
for battery in /sys/class/power_supply/BAT?*; do
@@ -43,18 +26,33 @@ for battery in /sys/class/power_supply/BAT?*; do
fi
case "$(cat "$battery/status" 2>&1)" in
- Full) status="⚑ " ;;
- Discharging)
+
+ "Full")
+ status="⚑"
+ ;;
+
+ "Discharging")
if [ "$capacity" -le 20 ]; then
status="ο„ͺ$status"
- color=1
fi
- ;;
- Charging) status="πŸ”Œ$status" ;;
- "Not charging") status="♻️" ;;
- Unknown) status="? $status" ;;
- *) exit 1 ;;
+ ;;
+
+ "Charging")
+ status="πŸ”Œ$status"
+ ;;
+
+ "Not charging")
+ status="♻️"
+ ;;
+
+ "Unknown")
+ status="? $status"
+ ;;
+
+ *)
+ exit 1
+ ;;
esac
- echo "β”Š $status $capacity%"
+ echo -e "β”Š $status $capacity%"
done
diff --git a/pw-systemstats b/pw-cputemp
index 76cec99..eda3871 100755
--- a/pw-systemstats
+++ b/pw-cputemp
@@ -21,18 +21,6 @@ fi
[ -z "$CPU_TEMP" ] && CPU_TEMP="N/A"
-
-# Try different fan sensors
-FAN_SPEED=$(sensors | awk '/^fan|^cpu_fan/ {print $2}')
-[ -z "$FAN_SPEED" ] && FAN_SPEED="N/A"
-
-
# Send to bar
-echo " πŸŒ€ $FAN_SPEED β”Š 🌑️ $CPU_TEMPσ°”„"
+echo -e " 🌑️ $CPU_TEMPΒ°C β”Š"
-# Clicking on bar
-case $BLOCK_BUTTON in
- 1) notify-send "$(sensors)";;
- 2) notify-send "button 2 clicked";;
- 3) notify-send "button 3 clicked";;
-esac
diff --git a/pw-date b/pw-date
index 17105e5..05b2998 100755
--- a/pw-date
+++ b/pw-date
@@ -1,26 +1,17 @@
#!/usr/bin/env bash
# unfortunately cal is a bit limited here,
-# so I use orage, an xfce4 calendar app
+# so I also use orage, an xfce4 calendar app
+# This is updated by signal 1, so 1 + 34 =
+# kill -35 $(pidof dwmblocks) or
+# pkill -RTMIN+1 dwmblocks
-# X220 screen is 1366x768
-width=300
-height=180
-X=$((1366-width))
-Y=24 # bar height
+
+echo -e "β”Š $(date '+%a %d %b %T')"
case $BLOCK_BUTTON in
- 1)
- pid=$(wmctrl -lp | awk '/Orage/{print $3}')
- if (( pid > 0 )) ; then
- kill -9 "$pid"
- else
- { orage > /dev/null 2>&1; } &
- wmctrl -r "orage" -e "0,$X,$Y,$width,$height"
- fi
- ;;
-
- 3)
+
+ 1)
TODAY=$(date '+%-d')
HEAD=$(cal | head -n1)
BODY=$(cal | tail -n7 | sed -z "s|$TODAY|<u><b>$TODAY</b></u>|1")
@@ -30,8 +21,24 @@ case $BLOCK_BUTTON in
-h string:x-canonical-private-synchronous:calendar \
-u normal
;;
+
+ 3)
+ # X220 screen is 1366x768
+ width=300
+ height=180
+ X=$((1366-width))
+ Y=24 # bar height
-
+ # toggle Orage on/off
+ pid=$(wmctrl -lp | awk '/Orage/{print $3}')
+ if (( pid > 0 )) ; then
+ kill -9 "$pid"
+ else
+ { orage > /dev/null 2>&1; } &
+ wmctrl -r "orage" -e "0,$X,$Y,$width,$height"
+ fi
+ ;;
+
esac
-echo "$(date '+%a %d %b %T')"
+exit 0
diff --git a/pw-fan b/pw-fan
new file mode 100755
index 0000000..4dea310
--- /dev/null
+++ b/pw-fan
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+# requires joypixels font in dwm config.def.h
+
+# Try different fan sensors
+FAN_SPEED=$(sensors | awk '/^fan|^cpu_fan/ {print $2}')
+[ -z "$FAN_SPEED" ] && FAN_SPEED="N/A"
+
+# Send to bar
+echo -e " πŸŒ€ $FAN_SPEED β”Š"
+
diff --git a/pw-music b/pw-music
new file mode 100755
index 0000000..f0f9112
--- /dev/null
+++ b/pw-music
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+STATUS=$(playerctl status)
+
+case $STATUS in
+
+ "Playing")
+ TITLE=$(playerctl metadata title | sed s/_/\ /g)
+ META="${TITLE:-Title}"
+ curstatus=" 🎡 $META β”Š"
+ ;;
+
+ "Paused")
+ TITLE=$(playerctl metadata title | sed s/.m4a//g)
+ META="${TITLE:-Title}"
+ curstatus=" ⏸️ $META β”Š"
+ ;;
+
+ *)
+ curstatus=" Player Off β”Š"
+ ;;
+esac
+
+echo -e "$curstatus"
+
+case "$BLOCK_BUTTON" in
+ 1)
+ playerctl play-pause
+ ;;
+esac
diff --git a/pw-update-fingerprint b/pw-update-fingerprint
index e25a0b4..60239fb 100755
--- a/pw-update-fingerprint
+++ b/pw-update-fingerprint
@@ -13,4 +13,4 @@ KEY=$(msmtp --serverinfo --tls --tls-certcheck=off --host="$MAILSERVER" --port="
# replace tls_fingerprint line in .msmtprc
sed -i "s/^tls_fingerprint.*/tls_fingerprint $KEY/g" .msmtprc
-echo ".msmtprc has been updated with the latest $MAILSERVER fingerprint."
+echo ".msmtprc has been updated with the latest mail.nagatha.fr fingerprint."