Display the wireless status on the emacs mode-line | Rida Ayed

Display the wireless status on the emacs mode-line

I found this code1 to display the wireless status in the modeline.

A first attempt led to nothing i.e. nothing was shown in my modeline.

I had to modify the regex in order to match the output of /proc/net/wireless:

diff --git a/wireless.el b/wireless.el
index 55ec7fc..e08f864 100644
--- a/wireless.el
+++ b/wireless.el
@@ -55,7 +55,7 @@
   :group 'wireless)

 (defcustom wireless-procfile-regexp
-  "^[ ]+\\(....\\):[ ]+\\([0-9]+\\)[ ]+\\([0-9]+\\)[ .]+\\([0-9]+\\)[ .]+\\([0-9]+\\)"
+  "\\(^.*\\):[ ]+\\([0-9]+\\)[ ]+\\([0-9]+\\)[ .]+\\(-?[0-9]+\\)[ .]+\\(-?[0-9]+\\)"
   "*Regular expression for extracting proc-file data."
   :type 'string
   :group 'wireless)

cat /proc/net/wireless
Inter-| sta-|   Quality        |   Discarded packets               | Missed | WE
 face | tus | link level noise |  nwid  crypt   frag  retry   misc | beacon | 22
wlp3s0: 0000   59.  -54.  -256        0      0      0      2    195        0

As as result, I now have the wireless card status displayed in my modeline: