diff options
author | Philip Wittamore <philip@wittamore.com> | 2025-06-28 00:36:47 +0200 |
---|---|---|
committer | Philip Wittamore <philip@wittamore.com> | 2025-06-28 00:36:47 +0200 |
commit | 4790f80cfc5bd977b336f4a3e112ae9faeafb6bc (patch) | |
tree | 249530d9edbfb12bf9e5085685ee0cd1dfe0344b | |
parent | 28dd2120a2551af6b901d37e66d23359298ec603 (diff) | |
download | scripts-4790f80cfc5bd977b336f4a3e112ae9faeafb6bc.tar.gz scripts-4790f80cfc5bd977b336f4a3e112ae9faeafb6bc.tar.bz2 scripts-4790f80cfc5bd977b336f4a3e112ae9faeafb6bc.zip |
update
-rwxr-xr-x | pw-battery | 108 | ||||
-rwxr-xr-x | pw-biff | 2 | ||||
-rwxr-xr-x | pw-cputemp | 3 | ||||
-rwxr-xr-x | pw-date | 5 | ||||
-rwxr-xr-x | pw-fan | 8 | ||||
-rwxr-xr-x | pw-music | 10 | ||||
-rwxr-xr-x | pw-pacman | 7 |
7 files changed, 80 insertions, 63 deletions
@@ -7,52 +7,62 @@ # kill -36 $(pidof dwmblocks) or # pkill -RTMIN+2 dwmblocks -# Loop through all attached batteries. -for battery in /sys/class/power_supply/BAT?*; do - # If non-first battery, print a space separator. - [ -n "${capacity+x}" ] && printf " " - - capacity="$(cat "$battery/capacity" 2>&1)" - if [ "$capacity" -gt 90 ]; then - status="✅ " - elif [ "$capacity" -gt 60 ]; then - status="🔋 " - elif [ "$capacity" -gt 40 ]; then - status="🪫 " - elif [ "$capacity" -gt 10 ]; then - status="⚠️ " - else - status="❌ " - fi - - case "$(cat "$battery/status" 2>&1)" in - - "Full") - status="⚡🔋" - ;; - - "Discharging") - if [ "$capacity" -le 20 ]; then - status="$status" - fi - ;; - - "Charging") - status="🔌$status" - ;; - - "Not charging") - status="♻" - ;; - - "Unknown") - status="? $status" - ;; - - *) - exit 1 - ;; - esac - - echo -e " $status $capacity% ┊" -done +bat="BAT0" + +battery="/sys/class/power_supply/$bat" + +capacity="$(cat "$battery/capacity" 2>&1)" +if [ "$capacity" -gt 95 ]; then + status="" +elif [ "$capacity" -gt 90 ]; then + status="" +elif [ "$capacity" -gt 80 ]; then + status="" +elif [ "$capacity" -gt 70 ]; then + status="" +elif [ "$capacity" -gt 60 ]; then + status="" +elif [ "$capacity" -gt 50 ]; then + status="" +elif [ "$capacity" -gt 40 ]; then + status="" +elif [ "$capacity" -gt 30 ]; then + status="" +elif [ "$capacity" -gt 20 ]; then + status="" +elif [ "$capacity" -gt 10 ]; then + status="" +else + status="" +fi + +case "$(cat "$battery/status" 2>&1)" in +"Full") + status="⚡$status" + ;; + +"Discharging") + #[ "$rrtn" -eq "$rrtn" ] && remaining="$(date -u -d @$((rrtn * 60)) +'%-Hh%-Mm')" + rrtn="$(cat /sys/devices/platform/smapi/$bat/remaining_running_time_now)" + [ "$rrtn" -eq "$rrtn" ] && remaining="$((rrtn/60))h$((rrtn%60))" + status="$remaining $status" + ;; + +"Charging") + status=" $status" + ;; + +"Not charging") + status=" status" + ;; + +"Unknown") + status="? $status" + ;; + +*) + exit 1 + ;; +esac + +echo -e " $status $capacity% \uE0b1" @@ -20,6 +20,6 @@ if (("$mailcount" > 0)); then -a "You have mail" \ -u critical \ -i internet-mail-symbolic \ - -h string:x-dunst-stack-tag:Mail "$1 has mail: $mailcount messages" + -h string:x-dunst-stack-tag:Mail "$1 has new mail: $mailcount messages" fi @@ -22,5 +22,6 @@ fi [ -z "$CPU_TEMP" ] && CPU_TEMP="N/A" # Send to bar -echo -e " 🌡$CPU_TEMP°C ┊" +echo -e " $CPU_TEMP°C" +exit 0 @@ -6,8 +6,7 @@ # kill -35 $(pidof dwmblocks) or # pkill -RTMIN+1 dwmblocks - -echo -e " $(date '+%a %d %b %T')" +echo -e " $(date '+%d %b %T')" case $BLOCK_BUTTON in @@ -34,7 +33,7 @@ case $BLOCK_BUTTON in #xdotool search --onlyvisible --sync --name "Orage" windowmove 1064 23 & { orage > /dev/null 2>&1; } & sleep 0.2 - wmctrl -r "Orage" -e 0,1064,23,300,180 + wmctrl -r "Orage" -e 0,1064,23,300,180 & fi ;; @@ -1,10 +1,8 @@ #!/usr/bin/env bash -# requires joypixels font in dwm config.def.h +# uses Nerdfonts # 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 ┊" +[ -z "$FAN_SPEED" ] || echo -e " $FAN_SPEED \uE0b1" +exit 0 @@ -7,17 +7,17 @@ case $STATUS in "Playing") TITLE=$(playerctl metadata title | sed s/_/\ /g) META="${TITLE:-Title}" - curstatus=" 🎵 $META ┊" + curstatus=" 🎵 $META \uE0b1" ;; "Paused") TITLE=$(playerctl metadata title | sed s/.m4a//g) META="${TITLE:-Title}" - curstatus=" ⏸️ $META ┊" - ;; + curstatus=" || $META \uE0b1" + ;; *) - curstatus=" No Player ┊" + curstatus=" " ;; esac @@ -28,3 +28,5 @@ case "$BLOCK_BUTTON" in playerctl play-pause ;; esac + +exit 0 diff --git a/pw-pacman b/pw-pacman new file mode 100755 index 0000000..9cbd484 --- /dev/null +++ b/pw-pacman @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +packages=$(checkupdates | wc -l) + +[ "$packages" -eq "0" ] || echo -e " $packages \uE0b1" + +exit 0 |