diff --git a/config/ags/modules/bar.ts b/config/ags/modules/bar.ts index b55dc924..9a81fc03 100644 --- a/config/ags/modules/bar.ts +++ b/config/ags/modules/bar.ts @@ -229,6 +229,8 @@ function SysTray() { const items = systemtray.items; // @ts-expect-error self.children = items.map((item) => { + if (!item.id) + return undefined; if (item.id.trim() != "nm-applet" && item.id.trim() != "blueman") { return Widget.Button({ child: Widget.Icon({ icon: item.bind("icon") }), diff --git a/config/ags/modules/misc/cickinsidepopupwindow (copy 1).ts b/config/ags/modules/misc/cickinsidepopupwindow (copy 1).ts new file mode 100644 index 00000000..15baa4fa --- /dev/null +++ b/config/ags/modules/misc/cickinsidepopupwindow (copy 1).ts @@ -0,0 +1,45 @@ +import App from "resource:///com/github/Aylur/ags/app.js"; +import Widget from "resource:///com/github/Aylur/ags/widget.js"; +import { WindowProps, Window } from "types/widgets/window"; +import Gtk from "gi://Gtk?version=3.0"; + +type _WindowProps = WindowProps> | undefined[]; + +type Type = { + name: string; + child: any; + showClassName?: string; + hideClassName?: string; +}; + +export default ({ + name, + child, + showClassName = "", + hideClassName = "", + ...props +}: T & Omit<_WindowProps, keyof Type>) => { + return Widget.Window({ + name, + visible: false, + type: Gtk.WindowType.POPUP, + layer: "overlay", + resizable: true, + ...props, + setup: (self) => { + self.keybind("Escape", () => App.closeWindow(name)); + self.on("button-press-event", () => App.closeWindow(name)); // Close on mouse click + + if (showClassName !== "" && hideClassName !== "") { + self.hook(App, (self, currentName, visible) => { + if (currentName === name) { + self.toggleClassName(hideClassName, !visible); + } + }); + + self.class_name = `${showClassName} ${hideClassName}`; + } + }, + child: child + }); +}; diff --git a/config/ags/modules/notificationPopups.ts b/config/ags/modules/notificationPopups.ts index a638d87d..f693571a 100644 --- a/config/ags/modules/notificationPopups.ts +++ b/config/ags/modules/notificationPopups.ts @@ -154,6 +154,7 @@ const NotificationReveal = (notification: NotificationType, visible = false, dis destroyWithAnims: any; count: number; id: number; + app: string; }; let box: Box; @@ -173,7 +174,8 @@ const NotificationReveal = (notification: NotificationType, visible = false, dis attribute: { destroyWithAnims: destroyWithAnims, count: 0, - id: notification.id + id: notification.id, + app: notification.app_name }, children: [firstRevealer] }); @@ -197,6 +199,29 @@ export function NotificationPopups( children: notifications.popups.map((id) => revealer(id, false, dismiss)) }); + function onChange() { + for (let i = 0; i < list.children.length; i++) { + const current = list.children[i]; + const next = list.children[i + 1]; + const prev = list.children[i - 1]; + let is_last = true; + let is_first = true; + if (next) { + if (next.attribute.app === current.attribute.app) { + is_last = false; + } + } + if (prev) { + if (prev.attribute.app === current.attribute.app) { + is_first = false; + } + } + current.toggleClassName("last", is_last); + current.toggleClassName("first", is_first); + current.toggleClassName("middle", !is_first && !is_last); + } + } + function onNotified(_: any, id: number) { const n = notifications.getNotification(id); if (notifications.dnd || !n) return; @@ -221,15 +246,17 @@ export function NotificationPopups( onDismissed(_, id); } }); + onChange(); } function onDismissed(_: any, id: number) { const original = list.children.find((n) => n.attribute.id === id); if (!original) return; original.attribute.count--; - if (original?.attribute.count <= 0) { - original?.attribute.destroyWithAnims(); + if (original.attribute.count <= 0) { + original.attribute.destroyWithAnims(); } + original.connect("destroy", () => onChange()) } list.hook(notifications, onNotified, "notified").hook(notifications, onDismissed, dismiss ? "dismissed" : "closed"); diff --git a/config/ags/modules/sideright/notifications.ts b/config/ags/modules/sideright/notifications.ts index 3fd49a93..7fc40bef 100644 --- a/config/ags/modules/sideright/notifications.ts +++ b/config/ags/modules/sideright/notifications.ts @@ -38,6 +38,7 @@ const NotificationReveal = (notification: NotificationType, visible = false, dis destroyWithAnims: any; count: number; id: number; + app: string; }; let box: Box; @@ -56,7 +57,8 @@ const NotificationReveal = (notification: NotificationType, visible = false, dis attribute: { destroyWithAnims: destroyWithAnims, count: 0, - id: notification.id + id: notification.id, + app: notification.app_name }, children: [firstRevealer] }); diff --git a/config/ags/style.css b/config/ags/style.css index d0ff7825..d2f82ac0 100644 --- a/config/ags/style.css +++ b/config/ags/style.css @@ -533,16 +533,16 @@ window.notification-popups box.notifications { transition: all 0.2s ease-in-out, border-radius 0.1s ease-in-out; } -.notifications_sidebar_scrollable viewport > box > :first-child .notification { +.notifications_sidebar_scrollable viewport > box > .first .notification{ border-radius: 14px 14px 6px 6px; } -.notifications_sidebar_scrollable viewport > box > :last-child .notification { +.notifications_sidebar_scrollable viewport > box > .last .notification { border-radius: 6px 6px 14px 14px; margin-bottom: 10px; } -.notifications_sidebar_scrollable viewport > box > :last-child:first-child .notification { +.notifications_sidebar_scrollable viewport > box > .first.last .notification { border-radius: 14px; }