summaryrefslogtreecommitdiff
path: root/rc.lua
diff options
context:
space:
mode:
authorache <ache@ache.one>2023-02-26 01:40:51 +0100
committerache <ache@ache.one>2023-02-26 01:40:51 +0100
commit7385c4c49d9dcf581c69c942a25535bd29ce66ac (patch)
tree549a6bdc79beb792991ed2688b06b2d0aa56aff0 /rc.lua
parentAdd ghost workspace 👻 (diff)
Show percentage of total RAM used
Diffstat (limited to 'rc.lua')
-rw-r--r--rc.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/rc.lua b/rc.lua
index 7194651..d9fe7a9 100644
--- a/rc.lua
+++ b/rc.lua
@@ -223,9 +223,10 @@ vicious.register(mpdwidget, vicious.widgets.mpd,
memwidget = lain.widget.mem({
settings = function()
int_mem_now_used = tonumber(mem_now.used)
- widget:set_markup(markup.fg.color("#dda", "🐏 " .. mem_now.used .. "M (" .. mem_now.perc .. "%)"))
+ local perc_total = math.floor((mem_now.used + mem_now.swapused) / (mem_now.total + mem_now.swap) * 100)
+ widget:set_markup(markup.fg.color("#dda", "🐏 " .. mem_now.used .. "M (" .. perc_total .. "%)"))
- if notify_ram and mem_now.perc >= 85 then
+ if notify_ram and mem_now.perc_total >= 85 then
naughty.notify({ preset = naughty.config.presets.critical,
title = "Niveau de RM",
text = "L'utilisation de la RAM dépasse 85%",