From ed05e9af2515c3c1c09becae5b405fc5074aa5e9 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Thu, 16 Jan 2025 18:47:23 +1100 Subject: notifications: make popup window --- src/modules/notifpopups.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/modules/notifpopups.tsx') diff --git a/src/modules/notifpopups.tsx b/src/modules/notifpopups.tsx index 5da3092..9e34549 100644 --- a/src/modules/notifpopups.tsx +++ b/src/modules/notifpopups.tsx @@ -1,4 +1,4 @@ -import { Astal, Gtk } from "astal/gtk3"; +import { App, Astal, Gtk } from "astal/gtk3"; import AstalNotifd from "gi://AstalNotifd"; import { notifpopups as config } from "../../config"; import { setupChildClickthrough } from "../utils/widgets"; @@ -16,7 +16,11 @@ export default () => ( setup={self => { const notifd = AstalNotifd.get_default(); const map = new Map(); + let notifsOpen = false; + self.hook(notifd, "notified", (self, id) => { + if (notifsOpen) return; + const notification = notifd.get_notification(id); const popup = () as Notification; @@ -41,6 +45,10 @@ export default () => ( }); self.hook(notifd, "resolved", (_, id) => map.get(id)?.destroyWithAnims()); + self.hook(App, "window-toggled", (_, window) => { + if (window.name === "notifications") notifsOpen = window.visible; + }); + // Change input region to child region so can click through empty space setupChildClickthrough(self); }} -- cgit v1.2.3-freya