]> git.rmz.io Git - dotfiles.git/commitdiff
network widget
authorSamir Benmendil <samir.benmendil@gmail.com>
Sat, 15 Jun 2013 02:32:31 +0000 (04:32 +0200)
committerSamir Benmendil <samir.benmendil@gmail.com>
Sat, 15 Jun 2013 02:32:31 +0000 (04:32 +0200)
I will probably remove it again since I can get the infe from the conky
HUD

awesome/topbar.lua
awesome/widgets/network_widget.lua [new file with mode: 0644]

index eea23d648ca142c69019140351f5d010984401e8..98ebb5b68a02bfa2d754e946170a18e44b43dc2b 100644 (file)
@@ -9,6 +9,8 @@ local volume_widget  = require("widgets/volume_widget")
 if utils.host == "chronos" then
     local battery_widget = require("widgets/battery_widget")
 end
 if utils.host == "chronos" then
     local battery_widget = require("widgets/battery_widget")
 end
+local network_widget = require("widgets/network_widget")
+
 -- Create a textclock widget
 mytextclock = awful.widget.textclock()
 
 -- Create a textclock widget
 mytextclock = awful.widget.textclock()
 
@@ -92,6 +94,7 @@ for s = 1, screen.count() do
     -- Widgets that are aligned to the right
     local right_layout = wibox.layout.fixed.horizontal()
     if s == 1 then right_layout:add(wibox.widget.systray()) end
     -- Widgets that are aligned to the right
     local right_layout = wibox.layout.fixed.horizontal()
     if s == 1 then right_layout:add(wibox.widget.systray()) end
+    right_layout:add(network_widget)
     right_layout:add(volume_widget)
     if utils.host == "chronos" then
         right_layout:add(battery_widget)
     right_layout:add(volume_widget)
     if utils.host == "chronos" then
         right_layout:add(battery_widget)
diff --git a/awesome/widgets/network_widget.lua b/awesome/widgets/network_widget.lua
new file mode 100644 (file)
index 0000000..59ebeec
--- /dev/null
@@ -0,0 +1,20 @@
+local wibox = require("wibox")
+local vicious = require("vicious")
+local naughty = require("naughty")
+local beautiful = require("beautiful")
+local pairs = pairs
+
+module("network_widget")
+
+local function netclosure(intf)
+    return function (_, args)
+        local up_mb = args["{"..intf.." up_kb}"]
+        local down_mb = args["{"..intf.." down_kb}"]
+        return "Net: ↑"..up_mb.." ↓"..down_mb
+    end
+end
+
+network_widget = wibox.widget.textbox()
+vicious.register(network_widget, vicious.widgets.net, netclosure("enp3s0"), 1)
+
+return network_widget