X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=x2%2Fsrc%2Fawk%2Fexe%2Fbar.awk;h=08750d4a2fa3f1940d8da5b7a111a4cd5567a80c;hb=64771080860a88a15fd348815ad4135d8bec13cb;hp=6fd5a939bb92751ecc0e8a776a20fac9277e4f72;hpb=07d371033e9273977ae0b4557c10588a3556d9b6;p=khatus.git diff --git a/x2/src/awk/exe/bar.awk b/x2/src/awk/exe/bar.awk index 6fd5a93..08750d4 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"] == 1) + 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"] > 0) + return sprintf("%d%%", link["value"]) + else + return "--" +} + # ----------------------------------------------------------------------------- # Bluetooth # ----------------------------------------------------------------------------- @@ -200,14 +218,15 @@ function bar_make_status_volume_alsa_device(device, m, l, r, show) { cache_get(r, "khatus_sensor_volume", "vol_right" Kfs device, 5) show = "--" 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 { + 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: " 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) } # -----------------------------------------------------------------------------