3 Licensed under GNU General Public License v2
5 * (c) 2010-2012, Peter Hofmann
9 local helpers = require("lain.helpers")
10 local wibox = require("wibox")
11 local open, match = io.open, string.match
14 -- lain.widget.sysload
16 local function factory(args)
17 local sysload = { widget = wibox.widget.textbox() }
18 local args = args or {}
19 local timeout = args.timeout or 2
20 local settings = args.settings or function() end
22 function sysload.update()
23 local f = open("/proc/loadavg")
24 local ret = f:read("*all")
27 load_1, load_5, load_15 = match(ret, "([^%s]+) ([^%s]+) ([^%s]+)")
29 widget = sysload.widget
33 helpers.newtimer("sysload", timeout, sysload.update)