diff options
Diffstat (limited to '.config/luastatus-scripts-dwm/battery.lua')
-rw-r--r-- | .config/luastatus-scripts-dwm/battery.lua | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/.config/luastatus-scripts-dwm/battery.lua b/.config/luastatus-scripts-dwm/battery.lua new file mode 100644 index 0000000..6155fd4 --- /dev/null +++ b/.config/luastatus-scripts-dwm/battery.lua @@ -0,0 +1,53 @@ +widget = luastatus.require_plugin('battery-linux').widget{ + period = 2, + cb = function(t) + icon = "" + if t.status == "Discharging" then + if t.capacity < 10 then + icon = "" + elseif t.capacity < 20 then + icon = "" + elseif t.capacity < 30 then + icon = "" + elseif t.capacity < 40 then + icon = "" + elseif t.capacity < 50 then + icon = "" + elseif t.capacity < 60 then + icon = "" + elseif t.capacity < 70 then + icon = "" + elseif t.capacity < 80 then + icon = "" + elseif t.capacity < 90 then + icon = "" + else + icon = "" + end + else + if t.capacity < 10 then + icon = "" + elseif t.capacity < 20 then + icon = "" + elseif t.capacity < 30 then + icon = "" + elseif t.capacity < 40 then + icon = "" + elseif t.capacity < 50 then + icon = "" + elseif t.capacity < 60 then + icon = "" + elseif t.capacity < 70 then + icon = "" + elseif t.capacity < 80 then + icon = "" + elseif t.capacity < 90 then + icon = "" + else + icon = "" + end + end + + return string.format('%s %3d%%', icon, t.capacity) + end, +} |