blob: 898be245ffaa54cdb48db4e71c8d015659568384 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
local awful = require("awful")
local wibox = require("wibox")
local watch = require("awful.widget.watch")
local NETWORK_DEVICE = "/home/pmakhov/.config/awesome/awesome-wm-widgets/network-widget/networkio.sh"
net_widget = wibox.widget {
font = "Play 9",
widget = wibox.widget.textbox
}
local rspeed_prev = 0;
local tspeed_prev = 0;
watch(NETWORK_DEVICE, 1,
function(widget, stdout, _, _, _)
local r, t = string.match(stdout, '(%d+);(%d+)')
local rspeed = r - rspeed_prev
local tspeed = t - tspeed_prev
rspeed_prev = r
tspeed_prev = t
widget:set_text(rspeed)
end,
net_widget)
|