diff options
author | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-05-14 22:50:39 +0530 |
---|---|---|
committer | Vidhu Kant Sharma <vidhukant@vidhukant.com> | 2025-05-14 22:50:39 +0530 |
commit | 05da0e10926d4ade3b10a55999a0ed1b797caf65 (patch) | |
tree | 97cf6a33e5ce90d57e6894b748b1e18ad690643e /.config/luastatus-scripts-dwm/battery.lua | |
parent | f9c150cf57732bb7b42c6b2a5db70039161f8c6d (diff) |
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, +} |