X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=x2%2Fsrc%2Fawk%2Fexe%2Fbar.awk;h=0e81833bf07f388875045fa6ce1da67259c192bc;hb=fcc91548b828f5f4dcbaebe64c18cc6bb1df5a88;hp=bd37305c57ad6de37d7c6f1b30eab929c3b44cf8;hpb=499c58a269a00e031302938b5a8f006f23aae451;p=khatus.git diff --git a/x2/src/awk/exe/bar.awk b/x2/src/awk/exe/bar.awk index bd37305..0e81833 100644 --- a/x2/src/awk/exe/bar.awk +++ b/x2/src/awk/exe/bar.awk @@ -152,9 +152,19 @@ function bar_make_status_disk_io_r( src) { # Network # ----------------------------------------------------------------------------- +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"]) + return "<>" + else + return "--" +} + function bar_make_status_net_addr(interface, src) { src = "khatus_sensor_net_addr_io" - return cache_get_fmt_def(src, "addr" Kfs interface, 5, "%s", "") + addr = cache_get_fmt_def(src, "addr" Kfs interface, 5, "%s") + return addr ? addr : "--" } function bar_make_status_net_io_w(interface, src) { @@ -172,6 +182,14 @@ 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_fmt_def(link, "khatus_sensor_net_wifi_status", "link" Kfs interface, 10) + if (!link["is_expired"] && link["value"]) + return sprintf("%d%%", link["value"]) + else + return "--" +} + # ----------------------------------------------------------------------------- # Bluetooth # ----------------------------------------------------------------------------- @@ -194,20 +212,21 @@ function bar_make_status_backlight_percent( src) { # Volume # ----------------------------------------------------------------------------- -function bar_make_status_volume_alsa_device(device, mu, vl, vr, show) { - cache_get(mu, "khatus_sensor_volume", "mute" Kfs device, 5) - cache_get(vl, "khatus_sensor_volume", "vol_left" Kfs device, 5) - cache_get(vr, "khatus_sensor_volume", "vol_right" Kfs device, 5) +function bar_make_status_volume_alsa_device(device, m, l, r, show) { + cache_get(m, "khatus_sensor_volume", "mute" Kfs device, 5) + cache_get(l, "khatus_sensor_volume", "vol_left" Kfs device, 5) + cache_get(r, "khatus_sensor_volume", "vol_right" Kfs device, 5) show = "--" - if (!mu["is_expired"] && !vl["is_expired"] && !vr["is_expired"]) { - if (mu["value"] == "yes") {show = "X"} - else if (mu["value"] == "no") {show = vl["value"] " " vr["value"]} - else { + if (!m["is_expired"] && !l["is_expired"] && !r["is_expired"]) { + if (m["value"] == "yes") + show = "X" + else if (m["value"] == "no") + show = l["value"] #" " r["value"] + else msg_out_log_error(\ "bar_make_status_volume_alsa_device: " device ". ", \ - "Unexpected value for 'mute' field: " mu["value"] \ + "Unexpected value for 'mute' field: " m["value"] \ ) - } } return show } @@ -240,11 +259,11 @@ function bar_make_status_mpd( state, status) { function bar_make_status_mpd_state_known(symbol, s, song, time, percentage) { s = "khatus_sensor_mpd" - song = cache_get_fmt_def(s, "song" , 5, "%s", "?") + #song = cache_get_fmt_def(s, "song" , 5, "%s", "?") time = cache_get_fmt_def(s, "play_time_minimal_units", 5, "%s", "?") percent = cache_get_fmt_def(s, "play_time_percentage" , 5, "%s", "?") - song = substr(song, 1, Opt_Mpd_Song_Max_Chars) - return sprintf("%s %s %s %s", symbol, time, percent, song) + #song = substr(song, 1, Opt_Mpd_Song_Max_Chars) + return sprintf("%s %s %s", symbol, time, percent) } # -----------------------------------------------------------------------------