2023-12-28 00:19:57 -05:00
|
|
|
import Bluetooth from 'resource:///com/github/Aylur/ags/service/bluetooth.js';
|
|
|
|
|
|
|
|
import { Label, Icon } from 'resource:///com/github/Aylur/ags/widget.js';
|
|
|
|
|
2024-01-13 23:38:31 -05:00
|
|
|
import HoverRevealer from './hover-revealer.ts';
|
2023-12-28 00:19:57 -05:00
|
|
|
|
|
|
|
|
|
|
|
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'),
|
|
|
|
});
|