diff options
| author | delta <darkussdelta@gmail.com> | 2023-03-04 22:04:55 +0100 |
|---|---|---|
| committer | delta <darkussdelta@gmail.com> | 2023-03-04 22:18:21 +0100 |
| commit | f0b32f45746c026d402651013b7e98315d6956a1 (patch) | |
| tree | f42609e98522da081cebdd21a674a702d1054bbc /.config/awesome/components/statusbar/battery.lua | |
| parent | a0f8b5fa6acdd1c2477fb1881dd9067956bf0ae6 (diff) | |
restructure awesome config, add fresnel
Diffstat (limited to '.config/awesome/components/statusbar/battery.lua')
| -rw-r--r-- | .config/awesome/components/statusbar/battery.lua | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/.config/awesome/components/statusbar/battery.lua b/.config/awesome/components/statusbar/battery.lua deleted file mode 100644 index 670b200..0000000 --- a/.config/awesome/components/statusbar/battery.lua +++ /dev/null @@ -1,78 +0,0 @@ -local awful = require "awful" -local xresources = require "beautiful.xresources" -local dpi = xresources.apply_dpi -local vars = require "themes.prismite.vars" -local wibox = require "wibox" - -local battery_inner = awful.widget.watch("cat /sys/class/power_supply/BAT0/capacity", 1, function(widget, stdout) - local icon = "" - local color = vars.colors.red - - if io.popen("cat /sys/class/power_supply/BAT0/status"):read("*a"):sub(0, -2) == "Charging" then - icon = "" - color = vars.colors.green - widget:set_markup("<span color=\"" .. color .. "\">" .. icon .. "</span>") - return - end - - local percent = tonumber(stdout) - - if percent <= 5 then - icon = "" - color = vars.colors.red - elseif percent <= 10 then - icon = "" - color = vars.colors.red - elseif percent <= 20 then - icon = "" - color = vars.colors.red - elseif percent <= 30 then - icon = "" - color = vars.colors.yellow - elseif percent <= 40 then - icon = "" - color = vars.colors.yellow - elseif percent <= 50 then - icon = "" - color = vars.colors.yellow - elseif percent <= 60 then - icon = "" - color = vars.colors.yellow - elseif percent <= 70 then - icon = "" - color = vars.colors.yellow - elseif percent <= 80 then - icon = "" - color = vars.colors.green - elseif percent <= 90 then - icon = "" - color = vars.colors.green - elseif percent <= 100 then - icon = "" - color = vars.colors.green - end - - widget:set_markup("<span color=\"" .. color .. "\">" .. icon .. "</span>") -end) - -local battery = wibox.widget { - widget = wibox.container.place, - battery_inner -} - -awful.tooltip { - objects = { battery }, - timer_function = function() - return io.popen("cat /sys/class/power_supply/BAT0/capacity"):read("*a"):sub(0, -2) .. "%" - end, - bg = vars.colors.bg, - fg = vars.colors.fg, - border_color = vars.colors.bright.black, - border_width = vars.border_width, - font = vars.font, - shape = vars.shape, - margin_leftright = dpi(6), - margin_topbottom = dpi(6) -} - -return battery |
