-- Create the battery widget:
local my_battery_widget = battery_widget{
screen = s,
device_path = '/org/freedesktop/UPower/devices/battery_BAT0',
widget_template = wibox.widget.textbox,
instant_update = true
}
-- When UPower updates the battery status, the widget is notified
-- and calls a signal you need to connect to:
my_battery_widget:connect_signal('upower::update', function (widget, device)
widget.text = string.format('%3d', device.percentage) .. '%'
naughty.notify({ title = "Battery Status", text = device.state, timeout = 0 })
end)
Doesn't yield anything. Tried all variations: state, State, status, Status; none of them returned anything. My battery widget works and it shows the percentage as it should, so at least i know that it's properly connected to UPower.
original thread: https://old.reddit.com/r/awesomewm/comments/esrhnk/i_wrote_a_upowerglib_based_battery_widget_for_the/if3n4xv/