summaryrefslogtreecommitdiff
path: root/src/widgets/popupwindow.ts
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-01-16 18:47:23 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-01-16 18:47:23 +1100
commited05e9af2515c3c1c09becae5b405fc5074aa5e9 (patch)
treeac6d4e9e4262b79d6eec4ce64ffd351d8ba4d315 /src/widgets/popupwindow.ts
parentrefactor: move ts to src (diff)
downloadcaelestia-shell-ed05e9af2515c3c1c09becae5b405fc5074aa5e9.tar.gz
caelestia-shell-ed05e9af2515c3c1c09becae5b405fc5074aa5e9.tar.bz2
caelestia-shell-ed05e9af2515c3c1c09becae5b405fc5074aa5e9.zip
notifications: make popup window
Diffstat (limited to 'src/widgets/popupwindow.ts')
-rw-r--r--src/widgets/popupwindow.ts5
1 files changed, 3 insertions, 2 deletions
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();