gluon-alfred: add fields idletime, memory and processes to statistics

This commit is contained in:
Matthias Schiffer 2014-06-09 19:37:49 +02:00
parent 7a3e8d1632
commit ea7774c0b6
3 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1 @@
return tonumber(util.trim(util.exec("cut -d' ' -f2 /proc/uptime")))

View File

@ -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,
}

View File

@ -0,0 +1,3 @@
local running, total = fs.readfile('/proc/loadavg'):match('^[^ ]+ [^ ]+ [^ ]+ (%d+)/(%d+)')
return { running = tonumber(running), total = tonumber(total) }