summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorache <ache@ache.one>2017-11-02 03:31:53 +0100
committerache <ache@ache.one>2017-11-02 03:31:53 +0100
commit0075053da55c651f1b56e2d8fc81e08a7bcc3988 (patch)
tree69e8ddbc34a174f35760eae30894965573bc009d
parentHelp popup (diff)
Network info widget
-rw-r--r--rc.lua27
1 files changed, 26 insertions, 1 deletions
diff --git a/rc.lua b/rc.lua
index c533ddf..d228287 100644
--- a/rc.lua
+++ b/rc.lua
@@ -205,6 +205,7 @@ spr = wibox.widget.textbox(' ⌁ ')
myemailwidget = wibox.widget.textbox()
mybatwidget = wibox.widget.textbox ('')
+mynetworkwidget = wibox.widget.textbox ('')
function act()
@@ -257,6 +258,30 @@ function act()
end
end)
+ --{{ Network
+ awful.spawn.easy_async("bash -c \"ip r | grep default | cut -d' ' -f 5,7\"",
+ function(stdout, stderr, reason, exit_code)
+ if not (stdout == "" or stdout == "\n") then
+ tmpPos = string.find(stdout, " ")
+ interface = string.sub(stdout, 0, tmpPos)
+ ip = string.sub(stdout,tmpPos, string.len(stdout)-1)
+ mynetworkwidget:set_text ( ip .. "@" .. interface)
+ awful.spawn.easy_async("bash -c \"iwconfig 2>1 | grep -v 'no wireless' | grep " .. interface .. " | cut -d':' -f 2 | cut -d'\\\"' -f2\"",
+ function(essid, stderr2, reason2, exit_code2)
+ awful.spawn.easy_async("bash -c \"iwconfig 2>1 | grep -v 'no wireless' | grep Signal | cut -d'=' -f 3 | cut -d' ' -f 1\"",
+ function(signal, stderr3, reason3, exit_code3)
+ mynetworkwidget:set_text ( string.sub(essid, 0, string.len(essid)-1) .. "#" .. signal)
+ end)
+ end)
+ else
+ mynetworkwidget:set_markup( "<s>ip</s>" )
+ end
+ end)
+
+
+
+
+
--{{ E-mail notification
awful.spawn.easy_async(
"bash -c \"which hasMail > /dev/null 2>&1 && hasMail\"",
@@ -352,7 +377,7 @@ for s = 1, screen.count() do
if s == 1 then right_layout:add(wibox.widget.systray()) end
right_layout:add(spr)
right_layout:add(mpdwidget)
- right_layout:add(wifiwidget)
+ right_layout:add(mynetworkwidget)
right_layout:add(spr)
right_layout:add(cpuwidget)
right_layout:add(spr)