mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-07-10 10:14:20 +02:00
widget: display battery level in red if low
This commit is contained in:
parent
860cc39867
commit
ba218af659
1 changed files with 12 additions and 2 deletions
|
@ -25,8 +25,18 @@ local batwidget = ""
|
||||||
if config.hostname == "guybrush" then
|
if config.hostname == "guybrush" then
|
||||||
batwidget = widget({ type = "textbox" })
|
batwidget = widget({ type = "textbox" })
|
||||||
vicious.register(batwidget, vicious.widgets.bat,
|
vicious.register(batwidget, vicious.widgets.bat,
|
||||||
'<span font="Terminus 8" color="' .. beautiful.fg_widget_label .. '">BAT: </span>' ..
|
function (widget, args)
|
||||||
'<span font="Terminus 8" color="' .. beautiful.fg_widget_value .. '">$1 $2%</span>',
|
local color = beautiful.fg_widget_value
|
||||||
|
local current = args[2]
|
||||||
|
if current < 10 then
|
||||||
|
color = beautiful.fg_widget_value_important
|
||||||
|
end
|
||||||
|
return string.format(
|
||||||
|
'<span font="Terminus 8" color="' .. beautiful.fg_widget_label ..
|
||||||
|
'">BAT: </span>' ..
|
||||||
|
'<span font="Terminus 8" color="' .. color ..
|
||||||
|
'">%s %d%%</span>', args[1], current)
|
||||||
|
end,
|
||||||
61, "BAT1")
|
61, "BAT1")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue