🔧 chore(window/floating-notifications): bring back hold on hover feature 🎉
This commit is contained in:
@@ -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 { timeout } from "ags/time";
|
||||
|
||||
|
||||
function getNotificationImage(notif: AstalNotifd.Notification|HistoryNotification): (string|undefined) {
|
||||
@@ -58,7 +59,9 @@ export function NotificationWidget({ notification, actionClicked, holdOnHover, s
|
||||
eventControllerMotion.connect("enter", () =>
|
||||
holdOnHover && Notifications.getDefault().holdNotification(notification.id)),
|
||||
eventControllerMotion.connect("leave", () =>
|
||||
holdOnHover && notification && Notifications.getDefault().removeNotification(notification.id))
|
||||
holdOnHover && notification && timeout(600, () =>
|
||||
Notifications.getDefault().removeNotification(notification.id)
|
||||
))
|
||||
]);
|
||||
|
||||
conns.set(gestureClick, [
|
||||
|
||||
@@ -21,13 +21,9 @@ export const FloatingNotifications = (mon: number) =>
|
||||
<Adw.Clamp maximumSize={size}>
|
||||
<Gtk.Box class={"float-notification"} widthRequest={size} vexpand={false}>
|
||||
|
||||
{/*
|
||||
Why is holdOnHover disabled: the shell for some reason crashes
|
||||
when removing the notification on hover-lost 💔
|
||||
*/}
|
||||
<NotificationWidget notification={notif} showTime={false}
|
||||
actionClose={() => Notifications.getDefault().removeNotification(notif)}
|
||||
holdOnHover={false} actionClicked={() => {
|
||||
holdOnHover actionClicked={() => {
|
||||
const viewAction = notif.actions.filter(a =>
|
||||
a.id.toLowerCase() === "view" ||
|
||||
a.label.toLowerCase() === "view"
|
||||
|
||||
Reference in New Issue
Block a user