From 77f49eaf38b0d416c8e0df23cf881cf75faf762b Mon Sep 17 00:00:00 2001 From: ache Date: Sun, 24 Sep 2017 21:53:48 +0200 Subject: Batterie color --- rc.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rc.lua b/rc.lua index 30f7356..a070554 100644 --- a/rc.lua +++ b/rc.lua @@ -215,7 +215,18 @@ function act() awful.spawn.easy_async("bash -c \"acpi | cut -d',' -f2 \"", function(percent, stderr, reason, exit_code) a,b = string.find( percent, "%%") - mybatwidget:set_text ( "🔋" .. string.sub(percent, 1, a+1)) + nPercent = tonumber(string.sub(percent,2,a-1)) + + naughty.notify({ preset = naughty.config.presets.critical, + title = "Niveau de batterie", + text = string.sub(percent,2,a-1) }) + if nPercent > 30 then + mybatwidget:set_markup_silently( markup("#19DF1D", "🔋") .. string.sub(percent, 1, a+1)) + elseif nPercent > 10 then + mybatwidget:set_markup_silently( markup("#E28126", "🔋") .. string.sub(percent, 1, a+1)) + else + mybatwidget:set_markup_silently( markup("#E61E1E", "🔋") .. string.sub(percent, 1, a+1)) + end -- str = awful.util.shell("acpi | cut -d',' -f2") if percent == " 21%\n" or percent == " 20%\n" then naughty.notify({ preset = naughty.config.presets.critical, -- cgit v1.2.3