summaryrefslogtreecommitdiff
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/notification.tsx11
-rw-r--r--src/widgets/popupwindow.ts5
2 files changed, 11 insertions, 5 deletions
diff --git a/src/widgets/notification.tsx b/src/widgets/notification.tsx
index 0bef5ca..adac831 100644
--- a/src/widgets/notification.tsx
+++ b/src/widgets/notification.tsx
@@ -57,12 +57,16 @@ export default class Notification extends Widget.Box {
#destroyed = false;
constructor({ notification, popup }: { notification: AstalNotifd.Notification; popup?: boolean }) {
- super();
+ super({ className: "notification" });
this.#revealer = (
- <revealer revealChild transitionType={Gtk.RevealerTransitionType.SLIDE_DOWN} transitionDuration={150}>
+ <revealer
+ revealChild={popup}
+ transitionType={Gtk.RevealerTransitionType.SLIDE_DOWN}
+ transitionDuration={150}
+ >
<box className="wrapper">
- <box vertical className={`notification ${urgencyToString(notification.urgency)}`}>
+ <box vertical className={`inner ${urgencyToString(notification.urgency)}`}>
<box className="header">
<AppIcon appIcon={notification.appIcon} desktopEntry={notification.appName} />
<label className="app-name" label={notification.appName ?? "Unknown"} />
@@ -101,6 +105,7 @@ export default class Notification extends Widget.Box {
const width = this.get_preferred_width()[1];
this.css = `margin-left: ${width}px; margin-right: -${width}px;`;
timeout(1, () => {
+ this.#revealer.revealChild = true;
this.css = `transition: 300ms cubic-bezier(0.05, 0.9, 0.1, 1.1); margin-left: 0; margin-right: 0;`;
});
diff --git a/src/widgets/popupwindow.ts b/src/widgets/popupwindow.ts
index 67aa0ff..9f5192e 100644
--- a/src/widgets/popupwindow.ts
+++ b/src/widgets/popupwindow.ts
@@ -28,10 +28,11 @@ export default class PopupWindow extends Widget.Window {
});
}
- popup_at_widget(widget: JSX.Element, event: Gdk.Event) {
+ popup_at_widget(widget: JSX.Element, event: Gdk.Event | Astal.ClickEvent) {
const { width, height } = widget.get_allocation();
- const [_, x, y] = event.get_coords();
+ const [_, x, y] = event instanceof Gdk.Event ? event.get_coords() : [null, event.x, event.y];
const { x: cx, y: cy } = AstalHyprland.get_default().get_cursor_position();
+ this.anchor = Astal.WindowAnchor.TOP | Astal.WindowAnchor.LEFT;
this.marginLeft = cx + ((width - this.get_preferred_width()[1]) / 2 - x);
this.marginTop = cy + (height - y);
this.show();