update example configs

This commit is contained in:
Aylur
2023-09-10 20:48:12 +02:00
parent 50c5edf5da
commit fd250aef78
3 changed files with 21 additions and 12 deletions
+13 -4
View File
@@ -1,4 +1,4 @@
const { Window, Box, Label } = ags.Widget;
const { Window, Box, Label, EventBox } = ags.Widget;
import {
NotificationList, DNDSwitch, ClearButton, PopupList,
} from './widgets.js';
@@ -19,10 +19,19 @@ const NotificationCenter = () => Window({
popup: true,
focusable: true,
child: Box({
vertical: true,
children: [
Header(),
NotificationList(),
EventBox({
hexpand: true,
connections: [['button-press-event', () =>
ags.App.closeWindow('notification-center')]]
}),
Box({
vertical: true,
children: [
Header(),
NotificationList(),
],
}),
],
}),
});
+6 -5
View File
@@ -7,10 +7,11 @@ const List = () => Box({
vertical: true,
vexpand: true,
connections: [[Notifications, box => {
box.children = Array.from(Notifications.notifications.values())
box.children = Notifications.notifications
.reverse()
.map(n => Notification(n));
box.visible = Notifications.notifications.size > 0;
box.visible = Notifications.notifications.length > 0;
}]],
});
@@ -25,7 +26,7 @@ const Placeholder = () => Box({
],
connections: [
[Notifications, box => {
box.visible = Notifications.notifications.size === 0;
box.visible = Notifications.notifications.length === 0;
}],
],
});
@@ -46,7 +47,7 @@ export const NotificationList = () => Scrollable({
export const ClearButton = () => Button({
onClicked: Notifications.clear,
connections: [[Notifications, button => {
button.sensitive = Notifications.notifications.size > 0;
button.sensitive = Notifications.notifications.length > 0;
}]],
child: Box({
children: [
@@ -57,7 +58,7 @@ export const ClearButton = () => Button({
['false', Icon('user-trash-symbolic')],
],
connections: [[Notifications, stack => {
stack.shown = `${Notifications.notifications.size > 0}`;
stack.shown = `${Notifications.notifications.length > 0}`;
}]],
}),
],
+2 -3
View File
@@ -59,13 +59,12 @@ const Notification = () => Box({
Icon({
icon: 'preferences-system-notifications-symbolic',
connections: [
[Notifications, icon => icon.visible = Notifications.popups.size > 0],
[Notifications, icon => icon.visible = Notifications.popups.length > 0],
],
}),
Label({
connections: [[Notifications, label => {
// notifications is a map, to get the last elememnt lets make an array
label.label = Array.from(Notifications.popups.values())?.pop()?.summary || '';
label.label = Notifications.popups[0]?.summary || '';
}]],
}),
],