Use smaller mpd state symbols for pause and stop
[khatus.git] / x2 / src / awk / exe / bar.awk
index 930db5d..1868f0e 100644 (file)
@@ -152,10 +152,11 @@ function bar_make_status_disk_io_r(    src) {
 # Network
 # -----------------------------------------------------------------------------
 
-function bar_make_status_net_iface_status(interface,    addr) {
-    cache_get(addr, "khatus_sensor_net_addr_io", "addr" Kfs interface, 5)
-    if (!addr["is_expired"] && addr["value"])
-        return "up"
+function bar_make_status_net_iface_status(interface,    is_plugged_in) {
+    # TODO: Integrate connection/address status into the symbol somehow.
+    cache_get(is_plugged_in, "khatus_sensor_net_carrier", interface, 5)
+    if (!is_plugged_in["is_expired"] && is_plugged_in["value"] == 1)
+        return "<>"
     else
         return "--"
 }
@@ -181,10 +182,26 @@ function bar_make_status_net_wifi(interface,    src) {
     return cache_get_fmt_def(src, "status" Kfs interface, 10, "%s")
 }
 
+function bar_make_status_net_wifi_link(interface,    link) {
+    cache_get(link, "khatus_sensor_net_wifi_status", "link" Kfs interface, 10)
+    if (!link["is_expired"] && link["value"] > 0)
+        return sprintf("%d%%", link["value"])
+    else
+        return "--"
+}
+
 # -----------------------------------------------------------------------------
 # Bluetooth
 # -----------------------------------------------------------------------------
 
+function bar_make_status_bluetooth(    src, controllers, devices) {
+    src = "khatus_sensor_bluetooth"
+    controllers = cache_get_fmt_def(src, "count_powered_controllers", 10, "%d")
+    devices     = cache_get_fmt_def(src, "count_connected_devices"  , 10, "%d")
+    # Using %s format bellow because default value is a string
+    return sprintf("%s:%s", controllers, devices)
+}
+
 function bar_make_status_bluetooth_power(    src) {
     src = "khatus_sensor_bluetooth_power"
     return cache_get_fmt_def(src, "power_status", 10, "%s")
@@ -232,9 +249,9 @@ function bar_make_status_mpd(    state, status) {
         if (state["value"] == "play") {
             status = bar_make_status_mpd_state_known("▶")
         } else if (state["value"] == "pause") {
-            status = bar_make_status_mpd_state_known("â\9d\9aâ\9d\9a")
+            status = bar_make_status_mpd_state_known("â\8f¸")
         } else if (state["value"] == "stop") {
-            status = bar_make_status_mpd_state_known("â¬\9b")
+            status = bar_make_status_mpd_state_known("â\8f¹")
         } else {
             msg_out_log_error(\
                 "bar_make_status_mpd", \
This page took 0.028326 seconds and 4 git commands to generate.