tweaks to battery

This commit is contained in:
Chris Cochrun 2024-07-17 13:48:56 -05:00
parent 73dd975c7e
commit 0714889627

View file

@ -3,15 +3,19 @@ const battery = await Service.import("battery");
const laptop = Utils.exec(`hostname`) === "syl";
const status = Variable(true);
export function BatteryPopup(monitor = laptop ? 0 : 2) {
const battery_percent = battery.bind("percent");
// status.value = battery.connect("charging");
console.log(status);
return Widget.Window({
monitor,
name: `battery${monitor}`,
class_name: "battery-popup",
anchor: [laptop ? "bottom" : "top"],
css: "margin-right: 30px",
visible: battery_percent.as(p => p < 25 ? battery.bind("charging").as(c => c == true ? true : false) : false),
visible: battery_percent.as(p => p < 25 ? charging.as(c => !c) : false),
child: Widget.Box({
// css: "padding: .8em",
children: [