Updated and completed the notifications and bluetooth module.
This commit is contained in:
@@ -6,16 +6,15 @@ export default () => {
|
||||
return Widget.Window({
|
||||
name: "notifications-window",
|
||||
class_name: "notifications-window",
|
||||
layer: "top",
|
||||
anchor: ["top", "right"],
|
||||
layer: "overlay",
|
||||
anchor: ["top","right"],
|
||||
monitor: 2,
|
||||
exclusivity: "ignore",
|
||||
child: Widget.Box({
|
||||
vertical: true,
|
||||
vertical: true,
|
||||
class_name: "notification-card-container",
|
||||
setup: (self) => {
|
||||
self.hook(notifs, () => {
|
||||
console.log(JSON.stringify(notifs.popups, null, 2));
|
||||
if (notifs.dnd) {
|
||||
return;
|
||||
}
|
||||
@@ -26,6 +25,7 @@ export default () => {
|
||||
Widget.Box({
|
||||
class_name: "notification-card-image-container",
|
||||
hpack: "center",
|
||||
vpack: "center",
|
||||
vexpand: false,
|
||||
child: Widget.Box({
|
||||
hpack: "center",
|
||||
@@ -40,80 +40,86 @@ export default () => {
|
||||
return [];
|
||||
};
|
||||
|
||||
return (self.children = notifs.popups.map((notif, index) => {
|
||||
return Widget.Box({
|
||||
child: Widget.Box({
|
||||
class_name: "notification-card",
|
||||
children: [
|
||||
...imageContainer(notif),
|
||||
Widget.Box({
|
||||
vertical: true,
|
||||
hpack: "end",
|
||||
class_name: "notification-card-content",
|
||||
children: [
|
||||
Widget.Box({
|
||||
class_name: "notification-card-header",
|
||||
const actionsContainer = (notif) => {
|
||||
if (notif.actions !== undefined && notif.actions.length > 0) {
|
||||
return [
|
||||
Widget.Box({
|
||||
class_name: "notification-card-actions",
|
||||
hpack: "start",
|
||||
children: notif.actions.map((action) => {
|
||||
return Widget.Button({
|
||||
class_name: "notification-action-buttons",
|
||||
on_primary_click: () => {
|
||||
notif.invoke(action.id);
|
||||
},
|
||||
child: Widget.Box({
|
||||
hpack: "center",
|
||||
children: [
|
||||
Widget.Label({
|
||||
class_name: "notification-card-header-label",
|
||||
truncate: "end",
|
||||
wrap: true,
|
||||
label: notif["summary"],
|
||||
class_name: "notification-action-buttons-label",
|
||||
label: action.label,
|
||||
}),
|
||||
],
|
||||
}),
|
||||
Widget.Box({
|
||||
class_name: "notification-card-body",
|
||||
vexpand: true,
|
||||
children: [
|
||||
Widget.Label({
|
||||
class_name: "notification-card-body-label",
|
||||
useMarkup: true,
|
||||
lines: 2,
|
||||
wrap: true,
|
||||
truncate: "end",
|
||||
label: notif["body"],
|
||||
}),
|
||||
],
|
||||
}),
|
||||
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: [
|
||||
Widget.Label({
|
||||
class_name: "notification-card-appname-label",
|
||||
truncate: "end",
|
||||
wrap: true,
|
||||
label: notif["app-name"].toUpperCase(),
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
});
|
||||
}),
|
||||
],
|
||||
}),
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
return [];
|
||||
};
|
||||
|
||||
return (self.children = notifs.popups.map((notif, index) => {
|
||||
// FIX: Bottom part of notification gets cut of... need to find and fix culprit
|
||||
return Widget.Box({
|
||||
class_name: "notification-card",
|
||||
children: [
|
||||
...imageContainer(notif),
|
||||
Widget.Box({
|
||||
vertical: true,
|
||||
class_name: "notification-card-content",
|
||||
children: [
|
||||
Widget.Box({
|
||||
class_name: "notification-card-header",
|
||||
children: [
|
||||
Widget.Label({
|
||||
class_name: "notification-card-header-label",
|
||||
truncate: "end",
|
||||
wrap: true,
|
||||
label: notif["summary"],
|
||||
}),
|
||||
],
|
||||
}),
|
||||
Widget.Box({
|
||||
class_name: "notification-card-body",
|
||||
children: [
|
||||
Widget.Label({
|
||||
class_name: "notification-card-body-label",
|
||||
useMarkup: true,
|
||||
lines: 2,
|
||||
wrap: true,
|
||||
maxWidthChars: 30,
|
||||
truncate: "end",
|
||||
label: notif["body"],
|
||||
}),
|
||||
],
|
||||
}),
|
||||
...actionsContainer(notif),
|
||||
Widget.Box({
|
||||
class_name: "notification-card-appname",
|
||||
children: [
|
||||
Widget.Label({
|
||||
class_name: "notification-card-appname-label",
|
||||
truncate: "end",
|
||||
wrap: true,
|
||||
label: notif["app-name"].toUpperCase(),
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
}),
|
||||
],
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user