From b12586365a3fafc0cfd6f6f316f61ab2bfb61e99 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Tue, 4 Mar 2025 02:56:48 +0100 Subject: [PATCH] Improve status bar. --- testing/home/t490s/.nonpath_bins/status.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/testing/home/t490s/.nonpath_bins/status.sh b/testing/home/t490s/.nonpath_bins/status.sh index 9e2b365..256d9c0 100755 --- a/testing/home/t490s/.nonpath_bins/status.sh +++ b/testing/home/t490s/.nonpath_bins/status.sh @@ -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 -- 2.30.2