blob: d13143a326d0c96da9ae6f34062b660f9cb9dd4e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
local astal = require("astal")
local Widget = require("astal.gtk3.widget")
local Battery = astal.require("AstalBattery")
local bind = astal.bind
return function()
local bat = Battery.get_default()
return Widget.Box({
class_name = "battery",
visible = bind(bat, "is-present"),
Widget.Icon({
icon = bind(bat, "battery-icon-name"),
}),
Widget.Label({
label = bind(bat, "percentage"):as(function(p)
return tostring(math.floor(p * 100)) .. '%'
end)
}),
})
end
|