-v GC_Interval=1800 \
-f <("$BIN"/khatus_gen_bar_make_status \
-v Status_Fmt=' E=%s%% M=%d%% P=[%s %sr %sd %st %si %sz] C=[%s %s°C %srpm] D=[%s%% %s▲ %s▼] W=[%s %s▲ %s▼] B=%s *=%s%% (%s) [%s] %s°F %s ' \
- -v Status_Args='@energy_percent,@memory_percent,@processes_count_all,@processes_count_r,@processes_count_d,@processes_count_t,@processes_count_i,@processes_count_z,@cpu_loadavg,@cpu_temp,@cpu_fan_speed,@disk_space,@disk_io_w,@disk_io_r,@net_wifi:wlp3s0,@net_io_w:wlp3s0,@net_io_r:wlp3s0,@bluetooth_power,@backlight_percent,@volume_pa_sink:0,@mpd,@weather_temp_f,@datetime' \
+ -v Status_Args='@energy_percent,@memory_percent,@processes_count_all,@processes_count_r,@processes_count_d,@processes_count_t,@processes_count_i,@processes_count_z,@cpu_loadavg,@cpu_temp,@cpu_fan_speed,@disk_space,@disk_io_w,@disk_io_r,@net_wifi:wlp3s0,@net_io_w:wlp3s0,@net_io_r:wlp3s0,@bluetooth_power,@backlight_percent,@volume_pa_device:0,@mpd,@weather_temp_f,@datetime' \
) \
| "$BIN"/khatus_actuate_status_bar_to_xsetroot_name \
) \
./bin/khatus \
--dir_bin ./bin \
- --wifi_interface wlp3s0 \
+ --wifi_interface wlp4s0 \
+ --screen_brightness_device_name intel_backlight \
| stdbuf -o L tee \
>(stdbuf -o L ./bin/khatus_bar \
-v Opt_Mpd_Song_Max_Chars=10 \
-v GC_Interval=300 \
-f <(./bin/khatus_gen_bar_make_status \
-v Status_Fmt=' E=%s%% M=%d%% P=[%s %sr %sd %st %si %sz] C=[%s %s°C %srpm] D=[%s%% %s▲ %s▼] W=[%s %s▲ %s▼] B=%s *=%s%% (%s) [%s] %s°F %s ' \
- -v Status_Args='@energy_percent,@memory_percent,@processes_count_all,@processes_count_r,@processes_count_d,@processes_count_t,@processes_count_i,@processes_count_z,@cpu_loadavg,@cpu_temp,@cpu_fan_speed,@disk_space,@disk_io_w,@disk_io_r,@net_wifi:wlp3s0,@net_io_w:wlp3s0,@net_io_r:wlp3s0,@bluetooth_power,@backlight_percent,@volume_pa_sink:0,@mpd,@weather_temp_f,@datetime' \
+ -v Status_Args='@energy_percent,@memory_percent,@processes_count_all,@processes_count_r,@processes_count_d,@processes_count_t,@processes_count_i,@processes_count_z,@cpu_loadavg,@cpu_temp,@cpu_fan_speed,@disk_space,@disk_io_w,@disk_io_r,@net_wifi:wlp4s0,@net_io_w:wlp4s0,@net_io_r:wlp4s0,@bluetooth_power,@backlight_percent,@volume:0,@mpd,@weather_temp_f,@datetime' \
) \
) \
>(stdbuf -o L ./bin/khatus_cache_dumper $(hostname) 5 "$PWD/data") \
# Volume
# -----------------------------------------------------------------------------
-function bar_make_status_volume_pulseaudio_sink(sink, mu, vl, vr, show) {
- cache_get(mu, "khatus_sensor_volume", "mute" Kfs sink, 5)
- cache_get(vl, "khatus_sensor_volume", "vol_left" Kfs sink, 5)
- cache_get(vr, "khatus_sensor_volume", "vol_right" Kfs sink, 5)
+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)
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 {
msg_out_log_error(\
- "bar_make_status_volume_pulseaudio_sink: " sink ". ", \
+ "bar_make_status_volume_alsa_device: " device ". ", \
"Unexpected value for 'mute' field: " mu["value"] \
)
}
aliases["@backlight_percent"] = "bar_make_status_backlight_percent()"
- aliases["@volume_pa_sink"] = "bar_make_status_volume_pulseaudio_sink(%d)"
- params["@volume_pa_sink"] = 1
+ aliases["@volume"] = "bar_make_status_volume_alsa_device(%d)"
+ params["@volume"] = 1
aliases["@mpd"] = "bar_make_status_mpd()"
next
}
+/^\t[A-Z].+:/ {
+ section = $1
+}
+
+section == "Properties:" {
+ read_property()
+}
+
/\tState:/ {
state[sink] = $2
next
END {
for (sink in state) {
- print("state" Kfs sink, state[sink])
- print("mute" Kfs sink, mute[sink])
- print("vol_left" Kfs sink, vol_left[sink])
- print("vol_right" Kfs sink, vol_right[sink])
+ device = properties[sink, "alsa.device"]
+ print("state" Kfs device, state[sink])
+ print("mute" Kfs device, mute[sink])
+ print("vol_left" Kfs device, vol_left[sink])
+ print("vol_right" Kfs device, vol_right[sink])
}
}
+
+function read_property() {
+ key = $1
+ # Yes, the sequence (x-1+1) is redundant, but it keeps the variable names
+ # true to their meaning:
+ val_begin = index($0, "\"") + 1 # +1 to exclude first quote
+ val_end = length($0) - 1 # -1 to exclude last quote
+ val_len = (val_end - val_begin) + 1 # +1 to include final character
+ val = substr($0, val_begin, val_len)
+ properties[sink, key] = val
+}