nixos-configs/devices/wim/config/ags/ts/bar/hovers/bluetooth.ts
matt1432 7c0e1658da
All checks were successful
Discord / discord commits (push) Has been skipped
refactor(ags wim): bundle all files through imports
2024-01-13 23:38:31 -05:00

27 lines
831 B
TypeScript

import Bluetooth from 'resource:///com/github/Aylur/ags/service/bluetooth.js';
import { Label, Icon } from 'resource:///com/github/Aylur/ags/widget.js';
import HoverRevealer from './hover-revealer.ts';
export default () => HoverRevealer({
class_name: 'bluetooth',
icon: Icon().hook(Bluetooth, (self) => {
if (Bluetooth.enabled) {
self.icon = Bluetooth.connected_devices[0] ?
Bluetooth.connected_devices[0].icon_name :
'bluetooth-active-symbolic';
}
else {
self.icon = 'bluetooth-disabled-symbolic';
}
}),
label: Label().hook(Bluetooth, (self) => {
self.label = Bluetooth.connected_devices[0] ?
`${Bluetooth.connected_devices[0]}` :
'Disconnected';
}, 'notify::connected-devices'),
});