Updated notifications to handle actions and added a blue dbus messenger to listen for bluetooth actions.

This commit is contained in:
Jas Singh
2024-06-19 01:53:27 -07:00
parent ca488f4fb6
commit dd13346e1b
7 changed files with 265 additions and 53 deletions

View File

@@ -122,14 +122,16 @@ export default () => {
class_name: "menu-icon-button-label delete bluetooth",
label: "󰆴",
}),
on_primary_click: () =>
on_primary_click: () => {
// dev.setConnection(false);
Utils.execAsync([
"bash",
"-c",
`bluetoothctl remove ${dev.address}`,
]).catch((err) =>
console.error("Bluetooth Remove", err),
),
);
},
}),
],
}),
@@ -188,29 +190,7 @@ export default () => {
hexpand: true,
class_name: `menu-button bluetooth ${device}`,
on_primary_click: () => {
Utils.execAsync([
"bash",
"-c",
`bluetoothctl pair ${device.address}`,
]).catch((err) => {
console.error(
`bluetoothctl pair ${device.address}`,
err,
);
setTimeout(() => {
Utils.execAsync([
"bash",
"-c",
`bluetoothctl connect ${device.address}`,
]).catch((err) =>
console.error(
`bluetoothctl connect ${device.address}`,
err,
),
);
}, 2000);
});
device.setConnection(true);
},
child: Widget.Box({
children: [
@@ -253,16 +233,6 @@ export default () => {
return Widget.Box({
vertical: true,
children: [
Widget.Box({
class_name: "menu-active-container bluetooth",
vertical: true,
// children: renderActivePlayback(),
}),
Widget.Box({
class_name: "menu-active-container bluetooth",
vertical: true,
// children: renderActiveInput(),
}),
Widget.Separator({
class_name: "menu-separator",
}),