Add method for wifi link strength only
[khatus.git] / x2 / src / awk / exe / gen_bar_make_status.awk
1 #! /usr/bin/awk -f
2
3 BEGIN {
4 aliases["@energy_percent"] = "bar_make_status_energy_percent()"
5 aliases["@energy_direction"] = "bar_make_status_energy_direction()"
6
7 aliases["@memory_percent"] = "bar_make_status_mem_percent()"
8
9 aliases["@processes_count_all"] = "bar_make_status_procs_count_all()"
10 aliases["@processes_count_r"] = "bar_make_status_procs_count_r()"
11 aliases["@processes_count_d"] = "bar_make_status_procs_count_d()"
12 aliases["@processes_count_t"] = "bar_make_status_procs_count_t()"
13 aliases["@processes_count_i"] = "bar_make_status_procs_count_i()"
14 aliases["@processes_count_z"] = "bar_make_status_procs_count_z()"
15
16 aliases["@cpu_loadavg"] = "bar_make_status_cpu_loadavg()"
17 aliases["@cpu_temp"] = "bar_make_status_cpu_temperature()"
18 aliases["@cpu_fan_speed"] = "bar_make_status_cpu_fan_speed()"
19
20 aliases["@disk_space"] = "bar_make_status_disk_space()"
21 aliases["@disk_io_w"] = "bar_make_status_disk_io_w()"
22 aliases["@disk_io_r"] = "bar_make_status_disk_io_r()"
23
24 aliases["@net_addr"] = "bar_make_status_net_addr(\"%s\")"
25 params["@net_addr"] = 1
26 aliases["@net_io_w"] = "bar_make_status_net_io_w(\"%s\")"
27 params["@net_io_w"] = 1
28 aliases["@net_io_r"] = "bar_make_status_net_io_r(\"%s\")"
29 params["@net_io_r"] = 1
30 aliases["@net_wifi"] = "bar_make_status_net_wifi(\"%s\")"
31 params["@net_wifi"] = 1
32 aliases["@net_wifi_link"] = "bar_make_status_net_wifi_link(\"%s\")"
33 params["@net_wifi_link"] = 1
34 aliases["@net_iface_status"] = "bar_make_status_net_iface_status(\"%s\")"
35 params["@net_iface_status"] = 1
36
37 aliases["@bluetooth_power"] = "bar_make_status_bluetooth_power()"
38
39 aliases["@backlight_percent"] = "bar_make_status_backlight_percent()"
40
41 aliases["@volume"] = "bar_make_status_volume_alsa_device(%d)"
42 params["@volume"] = 1
43
44 aliases["@mpd"] = "bar_make_status_mpd()"
45
46 aliases["@weather_temp_f"] = "bar_make_status_weather_temp_f()"
47
48 aliases["@datetime"] = "bar_make_status_datetime()"
49
50 out = "function bar_make_status() {\n"
51 n_args = split(Status_Args, args_arr, ",")
52 for (i=1; i<=n_args; i++) {
53 arg = args_arr[i]
54 split(arg, arg_parts, ":")
55 alias = arg_parts[1]
56 n_expected_params = params[alias]
57 if (n_expected_params == 0) {
58 function_call = aliases[alias]
59 } else if (n_expected_params == 1) {
60 function_call = sprintf(aliases[alias], arg_parts[2])
61 # TODO: Support params > 1
62 } else {
63 printf(\
64 "Unsupported number of params: %d in %s\n",
65 n_expected_params, alias) \
66 > "/dev/stderr"
67 exit(1)
68 }
69 if (function_call) {
70 args_str = args_str ", " function_call
71 } else {
72 printf("Unexpected status bar component alias: \"%s\"\n", alias) \
73 > "/dev/stderr"
74 exit(1)
75 }
76 }
77 out = out " return sprintf(\"" Status_Fmt "\"" args_str ");\n}";
78 print out
79 }
This page took 0.082179 seconds and 5 git commands to generate.