aboutsummaryrefslogtreecommitdiff
path: root/plugins/memoryusage.lua
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2021-04-10 11:41:27 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2021-04-10 11:41:27 +0200
commit34c911d9b254c1e9b3a68b050808584930e98797 (patch)
treead69d82b65aa8188ec06325a8ef12479a60cf00b /plugins/memoryusage.lua
parent5e753c5c4bf5b086f031fa0fbbe5a3b045298ab5 (diff)
downloadlite-xl-plugins-34c911d9b254c1e9b3a68b050808584930e98797.tar.gz
lite-xl-plugins-34c911d9b254c1e9b3a68b050808584930e98797.zip
Add memory usage plugin
Original implementation from AqilCont: https://github.com/franko/lite-xl/pull/108
Diffstat (limited to 'plugins/memoryusage.lua')
-rw-r--r--plugins/memoryusage.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/memoryusage.lua b/plugins/memoryusage.lua
new file mode 100644
index 0000000..38ca59d
--- /dev/null
+++ b/plugins/memoryusage.lua
@@ -0,0 +1,18 @@
+-- original implementation by AqilCont
+local style = require "core.style"
+local StatusView = require "core.statusview"
+
+local get_items = StatusView.get_items
+
+function StatusView:get_items()
+ local left, right = get_items(self)
+ local t = {
+ style.text, (math.floor(collectgarbage("count") / 10.24) / 100) .. " MB",
+ style.dim, self.separator2,
+ }
+ for i, item in ipairs(t) do
+ table.insert(right, i, item)
+ end
+ return left, right
+end
+