about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKevin Mandura <webmaster@kevin-mandura.de>2024-03-23 19:27:39 +0100
committerKevin Mandura <webmaster@kevin-mandura.de>2024-03-23 19:27:39 +0100
commit8634cafba01c974a487faa3a2e2c9211c253e1a5 (patch)
tree8d9c2fdf9f7ce30997ee3675bed774b30c974bc5
parent73f3ca7742fe010095eced0720a94eb1a91e4704 (diff)
downloaddwm-status-sh-8634cafba01c974a487faa3a2e2c9211c253e1a5.tar.gz
dwm-status-sh-8634cafba01c974a487faa3a2e2c9211c253e1a5.zip
General fixes
-rw-r--r--dwm-status.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/dwm-status.sh b/dwm-status.sh
index a755c2a..e9f5c56 100644
--- a/dwm-status.sh
+++ b/dwm-status.sh
@@ -124,7 +124,7 @@ initialize_cache_directory() {
     # Empty the cache directory and create empty cache files for a fresh
     # start.
     rm -f "$CONFIG_CACHE_DIR"/*
-    touch "$CACHE_NEW_MAILS_FILE" "$CACHE_ETHERNET_INTERFACE_FILE"
+    touch "$CACHE_NEW_MAILS_FILE" "$CACHE_ETHERNET_INTERFACE_FILE" "$CACHE_WLAN_INTERFACE_FILE" "$CACHE_VPN_INTERFACE_FILE" "$CACHE_CPU_TEMPERATURE_FILE" "$CACHE_CPU_USAGE_FILE" "$CACHE_AUDIO_VOLUME_FILE" "$CACHE_DISK_FREE_FILE" "$CACHE_BATTERY_FILE" "$CACHE_UPTIME_FILE" "$CACHE_DATE_TIME_FILE"
 }
 
 # Note:
@@ -208,14 +208,14 @@ module_wlan_interface() {
                 [ "$wlan_interface_operstate" = "up" ] && wlan_status=1; break
             fi
         done
+
+        # Cache the wlan status into a file.
+        printf "%s" "$wlan_status" > "$CACHE_WLAN_INTERFACE_FILE"
     else
         # Only read latest information stored inside the cache file.
         wlan_status=$(cat "$CACHE_WLAN_INTERFACE_FILE")
     fi
 
-    # Cache the wlan status into a file.
-    printf "%s" "$wlan_status" > "$CACHE_WLAN_INTERFACE_FILE"
-
     # Append to status bar string, if there is any active WLAN
     # interface.
     if [ "$wlan_status" = 1 ]; then
@@ -454,6 +454,9 @@ refresh_status_bar() {
         fi
     fi
 
+    # Remove trailing whitespaces from the status bar string.
+    status_bar_string=$(printf "%s" "$status_bar_string" | sed 's/[[:blank:]]\+$//')
+
     # Output the status bar string.
     xsetroot -name "$status_bar_string"
 }