summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i3status.c2
-rw-r--r--man/i3status.man4
-rw-r--r--src/print_wireless_info.c14
3 files changed, 17 insertions, 3 deletions
diff --git a/i3status.c b/i3status.c
index 30995b2..9d9921d 100644
--- a/i3status.c
+++ b/i3status.c
@@ -103,7 +103,7 @@ int main(int argc, char *argv[]) {
};
cfg_opt_t wireless_opts[] = {
- CFG_STR("format_up", "W: (%quality at %essid) %ip", CFGF_NONE),
+ CFG_STR("format_up", "W: (%quality at %essid, %bitrate) %ip", CFGF_NONE),
CFG_STR("format_down", "W: down", CFGF_NONE),
CFG_END()
};
diff --git a/man/i3status.man b/man/i3status.man
index 0274cca..a93f90d 100644
--- a/man/i3status.man
+++ b/man/i3status.man
@@ -57,7 +57,7 @@ order += "load"
order += "time"
wireless wlan0 {
- format_up = "W: (%quality at %essid) %ip"
+ format_up = "W: (%quality at %essid, %bitrate) %ip"
format_down = "W: down"
}
@@ -160,7 +160,7 @@ connected.
*Example order*: +wireless wlan0+
-*Example format*: +W: (%quality at %essid) %ip+
+*Example format*: +W: (%quality at %essid, %bitrate) %ip+
=== Ethernet
diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c
index 60eb906..3a96b86 100644
--- a/src/print_wireless_info.c
+++ b/src/print_wireless_info.c
@@ -25,6 +25,7 @@ typedef struct {
int signal_level_max;
int noise_level;
int noise_level_max;
+ int bitrate;
} wireless_info_t;
static int get_wireless_info(const char *interface, wireless_info_t *info) {
@@ -132,6 +133,10 @@ static int get_wireless_info(const char *interface, wireless_info_t *info) {
}
}
+ struct iwreq wrq;
+ if (iw_get_ext(skfd, interface, SIOCGIWRATE, &wrq) >= 0)
+ info->bitrate = wrq.u.bitrate.value;
+
close(skfd);
return 1;
#endif
@@ -210,6 +215,15 @@ void print_wireless_info(const char *interface, const char *format_up, const cha
else (void)printf("no IP");
walk += strlen("ip");
}
+
+ if (BEGINS_WITH(walk+1, "bitrate")) {
+ char buffer[128];
+
+ iw_print_bitrate(buffer, sizeof(buffer), info.bitrate);
+
+ printf("%s", buffer);
+ walk += strlen("bitrate");
+ }
}
(void)printf("%s", endcolor());