diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-06-06 23:42:59 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-06-06 23:42:59 +0200 |
commit | c00b14c75468f7c91cb0e89de20d8433fba7c917 (patch) | |
tree | e2117c1037dd772734e81c956380f4023687799c | |
parent | 669b6b86a128f7559b257e69f07e610e26d0cd23 (diff) | |
download | scripts-c00b14c75468f7c91cb0e89de20d8433fba7c917.tar.gz scripts-c00b14c75468f7c91cb0e89de20d8433fba7c917.tar.bz2 scripts-c00b14c75468f7c91cb0e89de20d8433fba7c917.zip |
update
-rwxr-xr-x | pw-battery | 60 | ||||
-rwxr-xr-x | pw-cputemp (renamed from pw-systemstats) | 14 | ||||
-rwxr-xr-x | pw-date | 45 | ||||
-rwxr-xr-x | pw-fan | 10 | ||||
-rwxr-xr-x | pw-music | 30 | ||||
-rwxr-xr-x | pw-update-fingerprint | 2 |
6 files changed, 97 insertions, 64 deletions
@@ -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 @@ -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 @@ -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." |