diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/idletime b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/idletime new file mode 100644 index 00000000..93165f05 --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/idletime @@ -0,0 +1 @@ +return tonumber(util.trim(util.exec("cut -d' ' -f2 /proc/uptime"))) diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/memory b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/memory new file mode 100644 index 00000000..7b07a107 --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/memory @@ -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, +} diff --git a/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/processes b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/processes new file mode 100644 index 00000000..33ecff66 --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/alfred/announce.d/statistics/processes @@ -0,0 +1,3 @@ +local running, total = fs.readfile('/proc/loadavg'):match('^[^ ]+ [^ ]+ [^ ]+ (%d+)/(%d+)') + +return { running = tonumber(running), total = tonumber(total) }