change variable names inside sb scripts, and add uptime

This commit is contained in:
frosty 2024-05-19 05:38:51 -04:00
parent 057e894770
commit 418f7d5c54
5 changed files with 20 additions and 15 deletions

View file

@ -1,5 +1,5 @@
#!/bin/sh
read -r capacity < /sys/class/power_supply/BAT1/capacity
read -r value < /sys/class/power_supply/BAT1/capacity
printf '[BAT %s%%]\n' "$capacity"
printf '[BAT %s%%]\n' "$value"

View file

@ -1,5 +1,5 @@
#!/bin/sh
_date=$(date '+%b %-d %Y %-I:%M %p')
value=$(date '+%b %-d %Y %-I:%M %p')
printf '[%s]\n' "$_date"
printf '[%s]\n' "$value"

View file

@ -1,5 +1,5 @@
#!/bin/sh
memory=$(free -h | awk '/Mem/ {printf "%s/%s\n", $3, $2}' | sed 's/Gi/G/g; s/Mi/M/g')
value=$(free -h | awk '/Mem/ {printf "%s/%s\n", $3, $2}' | sed 's/Gi/G/g; s/Mi/M/g')
printf '[MEM %s]\n' "$memory"
printf '[MEM %s]\n' "$value"

View file

@ -0,0 +1,5 @@
#!/bin/sh
value=$(uptime -p | sed 's/ day[s]*\b/d/g; s/ hour[s]*\b/h/g; s/ minute[s]*\b/m/g; s/up //; s/,//g')
printf '[%s]\n' "$value"

View file

@ -1,21 +1,21 @@
#!/bin/sh
volume=$(wpctl get-volume @DEFAULT_AUDIO_SINK@)
volume=${volume##Volume: }
volume=${volume%%.*}${volume##*.}
value=$(wpctl get-volume @DEFAULT_AUDIO_SINK@)
value=${value##Volume: }
value=${value%%.*}${value##*.}
case "$volume" in
case "$value" in
*MUTED*)
muted=1
volume=${volume%% \[MUTED\]}
value=${value%% \[MUTED\]}
;;
esac
volume=${volume#0}
volume=${volume#0}
value=${value#0}
value=${value#0}
if [ -z "$muted" ]; then
printf '[VOL %s%%]\n' "$volume"
printf '[VOL %s%%]\n' "$value"
else
printf '[VOL %s%% M]\n' "$volume"
printf '[VOL %s%% M]\n' "$value"
fi