From: Samir Benmendil Date: Sat, 15 Jun 2013 02:32:31 +0000 (+0200) Subject: network widget X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/24c4c19985f0a716adb31eda60c4afe232f4c324 network widget I will probably remove it again since I can get the infe from the conky HUD --- diff --git a/awesome/topbar.lua b/awesome/topbar.lua index eea23d6..98ebb5b 100644 --- a/awesome/topbar.lua +++ b/awesome/topbar.lua @@ -9,6 +9,8 @@ local volume_widget = require("widgets/volume_widget") 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() @@ -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 + right_layout:add(network_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 index 0000000..59ebeec --- /dev/null +++ b/awesome/widgets/network_widget.lua @@ -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