Show current MPD file
[khatus.git] / bin / khatus_show
index 4545a1f..f008d19 100755 (executable)
@@ -7,7 +7,7 @@ STATUS_DIR=$HOME/var/run/status
 STATUS_FILE__WIFI=$STATUS_DIR/wifi
 STATUS_FILE__ENERGY_NOTIFIED_BELLOW_HALF=$STATUS_DIR/notified_energy_bellow_half
 
-#load=$(cat /proc/loadavg | awk '{printf "%4.2f %4.2f %4.2f", $1, $2, $3}')
+load=$(awk '{printf("%4.2f", $1)}' /proc/loadavg)
 
 fan=$(awk '/^speed:/ {printf "%4d", $2}' /proc/acpi/ibm/fan)
 
@@ -342,6 +342,19 @@ mpd_state=$(
         '
 )
 
+mpd_current_file=$(
+    echo 'currentsong' \
+    | nc 127.0.0.1 6600 \
+    | awk -v max_chars=10 '
+        /^file:/ {
+            file = $2
+            for (i=3; i<=NF; i++) {file = file " " $i}
+            last = split(file, parts, "/")
+            print substr(parts[last], 1, max_chars)
+        }
+        '
+)
+
 echo \
 "\
  E$energy\
@@ -353,6 +366,9 @@ echo \
  C=[$cpu  ${temp}°C ${fan}rpm]\
  \
  \
+ L=$load\
+ \
+ \
  D$disk\
  \
  \
@@ -367,7 +383,7 @@ echo \
  \
  V=$volume\
  \
$mpd_state\
[$mpd_state $mpd_current_file]\
  \
  $signal_last_msg_age\
  \
This page took 0.024903 seconds and 4 git commands to generate.