diff --git a/nixosModules/ags/config/widgets/bluetooth/device.tsx b/nixosModules/ags/config/widgets/bluetooth/device.tsx
index 08579bf7..13836a3a 100644
--- a/nixosModules/ags/config/widgets/bluetooth/device.tsx
+++ b/nixosModules/ags/config/widgets/bluetooth/device.tsx
@@ -6,18 +6,103 @@ import AstalBluetooth from 'gi://AstalBluetooth';
import Separator from '../misc/separator';
+/* Types */
+interface DevToggleProps {
+ label: string
+ prop: keyof AstalBluetooth.Device
+ onToggle: (active: boolean) => void
+}
+
@register()
export default class DeviceWidget extends Widget.Revealer {
readonly dev: AstalBluetooth.Device;
constructor({ dev }: { dev: AstalBluetooth.Device }) {
+ const bluetooth = AstalBluetooth.get_default();
+
+ const DevToggle = ({ label, prop, onToggle }: DevToggleProps) => (
+
+
+
+
+
+ {
+ self.connect('notify::active', () => {
+ onToggle(self.active);
+ });
+ }}
+ />
+
+ );
+
const rev = (
-
- TODO: add buttons here
+
+
+
+ {
+ if (active) {
+ dev.connect_device();
+ }
+ else {
+ dev.disconnect_device();
+ }
+ }}
+ />
+
+
+
+ {
+ dev.set_trusted(active);
+ }}
+ />
+
+
+
+ {
+ if (active) {
+ dev.pair();
+ }
+ else {
+ bluetooth.adapter.remove_device(dev);
+ }
+ }}
+ />
+
+
+
+ {
+ dev.set_blocked(active);
+ }}
+ />
+
+
) as Widget.Revealer;
@@ -61,6 +146,7 @@ export default class DeviceWidget extends Widget.Revealer {
{button}
{rev}
+
),
});