hopefully the last complete restructure of this repo
This commit is contained in:
34
home-manager/dotfiles/ags/bluetooth.js
Executable file
34
home-manager/dotfiles/ags/bluetooth.js
Executable file
@@ -0,0 +1,34 @@
|
||||
const bluetooth = await Service.import("bluetooth")
|
||||
|
||||
|
||||
export function ConnectedList() {
|
||||
return Widget.Box({
|
||||
class_name: "btdevices",
|
||||
setup: self => self.hook(bluetooth, self => {
|
||||
self.children = bluetooth.connected_devices
|
||||
.map(({ address, icon_name, name }) => Widget.EventBox({
|
||||
child: Widget.Icon(icon_name + '-symbolic'),
|
||||
tooltip_text: name,
|
||||
on_primary_click: () => {
|
||||
bluetooth.getDevice(address).setConnection(false)
|
||||
},
|
||||
}));
|
||||
|
||||
self.visible = bluetooth.connected_devices.length > 0;
|
||||
}, 'notify::connected-devices'),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export default function Bluetooth() {
|
||||
|
||||
|
||||
|
||||
return Widget.EventBox({
|
||||
tooltip_text: bluetooth.bind('enabled').as(on => on ? 'Enabled' : 'Disabled'),
|
||||
child: Widget.Icon({
|
||||
icon: bluetooth.bind('enabled').as(on =>
|
||||
`bluetooth-${on ? 'active' : 'disabled'}-symbolic`),
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user