home · contact · privacy
Improve status bar. master
authorChristian Heller <c.heller@plomlompom.de>
Mon, 17 Mar 2025 19:41:33 +0000 (20:41 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 17 Mar 2025 19:41:33 +0000 (20:41 +0100)
testing/home/t490s/.nonpath_bins/status.sh

index dcc30f10509dd28ecdcf27003622ebbb84eccd19..e3bb5f958167728428337a3de056157ebabb6a6b 100755 (executable)
@@ -26,7 +26,17 @@ print_bar_element() {
 }
 
 print_online() {
 }
 
 print_online() {
-    print_bar_element "$(ip -4 addr show scope global | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | head -1)"
+    show_conn() {
+        COLOR="${COL_GREEN}"
+        IP=$(ip --brief addr show | grep "$2" | sed -E 's/ +/\t/g' | cut -f3 | cut -f1 -d'/')
+        if [ -z "${IP}" ]; then
+           IP=-
+           COLOR="${COL_RED}"
+        fi
+        print_bar_element "$1:${IP}" "${COLOR}" "$3"
+    }
+    show_conn E enp 10
+    show_conn W wlp
 }
 
 print_battery() {
 }
 
 print_battery() {
@@ -55,7 +65,7 @@ print_battery() {
 }
 
 print_temperature() {
 }
 
 print_temperature() {
-    COLOR="${COL_WHITE}"
+    COLOR="${COL_GREEN}"
     TEMPERATURE=$(cat ${SYSCLASS_DIR}/thermal/thermal_zone0/temp)
     TEMPERATURE_IN_C=$(printf "%d" $(calc "${TEMPERATURE} // 1000"))
     if [ $TEMPERATURE_IN_C -gt 85 ]; then
     TEMPERATURE=$(cat ${SYSCLASS_DIR}/thermal/thermal_zone0/temp)
     TEMPERATURE_IN_C=$(printf "%d" $(calc "${TEMPERATURE} // 1000"))
     if [ $TEMPERATURE_IN_C -gt 85 ]; then