Files
dotfiles/home/natto/ags/windows/bar/bluetooth.js
2024-06-01 18:10:31 +05:30

20 lines
529 B
JavaScript

const bluetooth = await Service.import("bluetooth");
export default () =>
Widget.Icon({
setup: (self) =>
self.hook(
bluetooth,
(self) => {
self.tooltipText = bluetooth.connected_devices
.map(({ name }) => name)
.join("\n");
self.visible = bluetooth.connected_devices.length > 0;
},
"notify::connected-devices",
),
icon: bluetooth
.bind("enabled")
.as((on) => `bluetooth-${on ? "active" : "disabled"}-symbolic`),
});