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

@@ -15,6 +15,7 @@ export default () => {
class_name: "notification-card-container",
setup: (self) => {
self.hook(notifs, () => {
console.log(JSON.stringify(notifs.popups, null, 2));
if (notifs.dnd) {
return;
}
@@ -25,10 +26,10 @@ export default () => {
Widget.Box({
class_name: "notification-card-image-container",
hpack: "center",
vexpand: true,
vexpand: false,
child: Widget.Box({
hpack: "center",
vexpand: true,
vexpand: false,
class_name: "notification-card-image",
css: `background-image: url("${notif.image}")`,
}),
@@ -40,13 +41,7 @@ export default () => {
};
return (self.children = notifs.popups.map((notif, index) => {
return Widget.Button({
on_primary_click: () => {
notifs.CloseNotification(notif.id);
},
on_secondary_click: () => {
notifs.CloseNotification(notif.id);
},
return Widget.Box({
child: Widget.Box({
class_name: "notification-card",
children: [
@@ -81,6 +76,29 @@ export default () => {
}),
],
}),
Widget.Box({
class_name: "notification-card-actions",
children: notif.actions.map((action) => {
return Widget.Button({
class_name: "notification-action-buttons",
on_primary_click: () => {
console.log(`clicked: ${action.id}`);
notif.invoke(action.id);
},
child: Widget.Box({
children: [
Widget.Label({
hpack: "center",
hexpand: true,
class_name:
"notification-action-buttons-label",
label: action.label,
}),
],
}),
});
}),
}),
Widget.Box({
class_name: "notification-card-appname",
children: [