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 0000000000000000000000000000000000000000..93165f05cb7e6d485ee7b3402b8d95088ba717da --- /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 0000000000000000000000000000000000000000..7b07a1079e0dfe3442c7d939613e521161c824b1 --- /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 0000000000000000000000000000000000000000..33ecff668324e9b762a8d8fb1d2eb842415520cd --- /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) }