diff options
author | ache <ache@ache.one> | 2017-09-24 21:53:48 +0200 |
---|---|---|
committer | ache <ache@ache.one> | 2017-09-24 21:53:48 +0200 |
commit | 77f49eaf38b0d416c8e0df23cf881cf75faf762b (patch) | |
tree | 119fb633995aaa642c45a4d57c1f9ce56ec6c794 | |
parent | Rofi integration (diff) |
Batterie color
-rw-r--r-- | rc.lua | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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, |