gluon-alfred: add fields idletime, memory and processes to statistics
This commit is contained in:
parent
7a3e8d1632
commit
ea7774c0b6
@ -0,0 +1 @@
|
||||
return tonumber(util.trim(util.exec("cut -d' ' -f2 /proc/uptime")))
|
@ -0,0 +1,13 @@
|
||||
local data = fs.readfile('/proc/meminfo')
|
||||
|
||||
local fields = {}
|
||||
for k, v in data:gmatch('([^\n:]+):%s*(%d+) kB') do
|
||||
fields[k] = tonumber(v)
|
||||
end
|
||||
|
||||
return {
|
||||
total = fields.MemTotal,
|
||||
free = fields.MemFree,
|
||||
buffers = fields.Buffers,
|
||||
cached = fields.Cached,
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
local running, total = fs.readfile('/proc/loadavg'):match('^[^ ]+ [^ ]+ [^ ]+ (%d+)/(%d+)')
|
||||
|
||||
return { running = tonumber(running), total = tonumber(total) }
|
Loading…
Reference in New Issue
Block a user