Initial commit
This commit is contained in:
35
unused/battery.lua
Normal file
35
unused/battery.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
local theme = require('theme.base_theme')
|
||||
local lain = require('lain')
|
||||
local wibox = require('wibox')
|
||||
|
||||
local baticon = wibox.widget.imagebox(nil)
|
||||
local bat = lain.widget.bat({
|
||||
settings = function()
|
||||
-- luacheck: globals widget bat_now
|
||||
if bat_now.ac_status == 1 or bat_now.perc == 'N/A' then
|
||||
baticon:set_image(theme.widget_bat_charge)
|
||||
elseif bat_now.perc < 5 then
|
||||
baticon:set_image(theme.widget_bat_empty)
|
||||
elseif bat_now.perc < 15 then
|
||||
baticon:set_image(theme.widget_bat_low)
|
||||
elseif bat_now.perc < 50 then
|
||||
baticon:set_image(theme.widget_bat_mid)
|
||||
elseif bat_now.perc < 95 then
|
||||
baticon:set_image(theme.widget_bat_high)
|
||||
else
|
||||
baticon:set_image(theme.widget_bat_full)
|
||||
end
|
||||
local perc = bat_now.perc ~= 'N/A' and bat_now.perc .. '%' or bat_now.perc
|
||||
|
||||
if bat_now.ac_status == 1 then
|
||||
perc = perc .. ' plug'
|
||||
end
|
||||
|
||||
widget:set_text(perc)
|
||||
end,
|
||||
})
|
||||
|
||||
return { {
|
||||
widget = wibox.layout.fixed.horizontal(baticon, bat.widget),
|
||||
bg = '#f1af5f',
|
||||
} }
|
||||
Reference in New Issue
Block a user