home · contact · privacy
Improve status bar.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 4 Mar 2025 01:56:48 +0000 (02:56 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 4 Mar 2025 01:56:48 +0000 (02:56 +0100)
testing/home/t490s/.nonpath_bins/status.sh

index 9e2b365736949ee4448c8592cfcb66407a608d0f..256d9c09b959b7fa25b7d6d682c0c818a89abc44 100755 (executable)
@@ -1,12 +1,13 @@
 #!/bin/sh
 # see sway-bar(5) and swaybar-protocol(7)
-MEGA=1000
+KILO=1000
 printf '{ "version": 1 }\n[\n' 
 while true; do
   printf '  [\n'
-  printf '    {"full_text": "%s"},\n' "$(ip -4 addr show scope global | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
-  printf '    {"full_text": "%d° C"},\n' $(calc "$(cat /sys/class/thermal/thermal_zone0/temp) // ${MEGA}")  # thermal_zone0 is what ACPI's interested in, so probably a fair choice among the many alternatives
-  printf '    {"full_text": "%s"},\n' "$(date +'%Y-%m-%d %H:%M:%S/%Z')"
+  printf '    {"separator_block_width": 20, "full_text": "%s"},\n' "$(ip -4 addr show scope global | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
+  printf '    {"separator_block_width": 20, "full_text": "%s"},\n' "$(cat /sys/class/power_supply/BAT0/status)"
+  printf '    {"separator_block_width": 20, "full_text": "%d° C"},\n' $(calc "$(cat /sys/class/thermal/thermal_zone0/temp) // ${KILO}")
+  printf '    {"separator_block_width": 20, "full_text": "%s"},\n' "$(date +'%Y-%m-%d %H:%M:%S/%Z')"
   printf '  ],\n'
   sleep 1
 done