From 7385c4c49d9dcf581c69c942a25535bd29ce66ac Mon Sep 17 00:00:00 2001 From: ache Date: Sun, 26 Feb 2023 01:40:51 +0100 Subject: Show percentage of total RAM used --- rc.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'rc.lua') 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%", -- cgit v1.2.3