feat(notification): dismiss popup on unhover if set on config

This commit is contained in:
retrozinndev
2025-11-11 18:34:39 -03:00
parent cd8a39fc9f
commit f9e65c6b5b
+18 -3
View File
@@ -9,6 +9,7 @@ import GObject from "ags/gobject";
import AstalNotifd from "gi://AstalNotifd";
import Pango from "gi://Pango?version=1.0";
import GLib from "gi://GLib?version=2.0";
import { generalConfig } from "../config";
function getNotificationImage(notif: AstalNotifd.Notification|HistoryNotification): (string|undefined) {
@@ -51,9 +52,23 @@ export function NotificationWidget({ notification, actionClicked, holdOnHover, s
<Gtk.EventControllerMotion onEnter={() => holdOnHover &&
Notifications.getDefault().holdNotification(notification.id)
} onLeave={() => holdOnHover &&
Notifications.getDefault().releaseNotification(notification.id)
}
} onLeave={() => {
if(!holdOnHover)
return;
const dismissOnUnhover = generalConfig
.getProperty("notifications.dismiss_on_unhover", "boolean");
if(dismissOnUnhover) {
setTimeout(() =>
Notifications.getDefault().removeNotification(notification.id),
600);
return;
}
Notifications.getDefault().releaseNotification(notification.id);
}}
/>
<Gtk.GestureClick onReleased={(gesture) =>
gesture.get_current_button() === Gdk.BUTTON_PRIMARY &&