home · contact · privacy
Improve status script; master
authorChristian Heller <c.heller@plomlompom.de>
Tue, 18 Mar 2025 00:08:09 +0000 (01:08 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 18 Mar 2025 00:08:09 +0000 (01:08 +0100)
testing/home/t490s/.nonpath_bins/status.sh

index a1b965e9dccfbd5a1728f706ab82ece05c995d63..ee2e226af401003708d1154bec7fa7e5f60139a2 100755 (executable)
@@ -54,7 +54,7 @@ print_battery() {
     elif [ "${CHARGE}" -lt 65 ]; then
         COLOR="${COL_YELLOW}"
     fi
-    print_bar_block "${CHARGE}" "${COLOR}" 0
+    print_bar_block "${CHARGE}%" "${COLOR}" 0
 
     COLOR="${COL_WHITE}"
     STATUS=$(cat "${BAT_DIR}/status")
@@ -70,7 +70,7 @@ print_battery() {
     fi
     print_bar_block "${CHARGING}" "${COLOR}" 0
 
-    print_bar_block "$(calc_percent full full_design)"
+    print_bar_block "$(calc_percent full full_design)%"
 }
 
 print_temperature() {
@@ -95,6 +95,15 @@ print_datetime() {
     print_bar_block "${TZ}" ""
 }
 
+print_volume() {
+    MUTE=M
+    if [ "$(pactl get-sink-mute 0)" = "Mute: no" ]; then
+        MUTE=
+       COLOR="${COL_WHITE}"
+    fi
+    print_bar_block "v:${MUTE}$(pactl get-sink-volume 0 | head -1 | cut -d' ' -f5)" "${COLOR}"
+}
+
 print_keyboard() {
     LAYOUT=$(swaymsg -t get_inputs | grep 'xkb_active_layout_name' | sed -E 's/[ ,"]+//g' | cut -d':' -f2 | head -1)
     if [ "${LAYOUT}" = "English(US)" ]; then
@@ -114,6 +123,7 @@ while true; do
     print_battery
     print_temperature
     print_datetime
+    print_volume
     print_keyboard
     printf '],'
     sleep 0.1