fix(ags): make popup notifs actually gone after being hovered

This commit is contained in:
matt1432 2023-10-28 13:04:35 -04:00
parent 59544dc14c
commit 57c41f9d49
3 changed files with 26 additions and 22 deletions

View file

@ -87,7 +87,10 @@ const NotificationIcon = notif => {
});
};
export default ({ notif, command = () => {} } = {}) => {
export default ({
notif,
command = () => {},
} = {}) => {
const BlockedApps = [
'Spotify',
];

View file

@ -101,7 +101,8 @@ export default ({
self.setStyle(`transition: margin 0.5s ease, opacity 0.5s ease;
margin-left: ${startMargin}px;
margin-right: ${startMargin}px;
margin-bottom: unset; margin-top: unset; opacity: 1;`);
margin-bottom: unset; margin-top: unset;
opacity: 1;`);
});
Utils.timeout(1000, () => self._ready = true);
return;
@ -127,7 +128,8 @@ export default ({
self.setStyle(`transition: margin 0.5s ease, opacity 0.5s ease;
margin-left: ${startMargin}px;
margin-right: ${startMargin}px;
margin-bottom: unset; margin-top: unset; opacity: 1;`);
margin-bottom: unset; margin-top: unset;
opacity: 1;`);
if (widget.window)
widget.window.set_cursor(Gdk.Cursor.new_from_name(display, 'grab'));

View file

@ -12,18 +12,15 @@ const Popups = () => Box({
['map', new Map()],
['dismiss', (box, id, force = false) => {
if (!id || !box._map.has(id) ||
box._map.get(id)._hovered && !force)
if (!id || !box._map.has(id) || box._map.get(id)._hovered && !force)
return;
if (box._map.size - 1 === 0)
box.get_parent().reveal_child = false;
Utils.timeout(200, () => {
if (box._map.get(id)?.interval) {
box._map.get(id).interval.destroy();
GLib.source_remove(box._map.get(id).interval);
box._map.get(id).interval = undefined;
}
box._map.get(id)?.destroy();
@ -53,12 +50,14 @@ const Popups = () => Box({
});
box._map.get(id).interval = Utils.interval(4500, () => {
if (!box._map.get(id)._hovered) {
box._map.get(id).child.setStyle(box._map.get(id).child._leftAnim1);
const notif = box._map.get(id);
if (!notif._hovered) {
notif.child.setStyle(notif.child._leftAnim1);
if (box._map.get(id).interval) {
GLib.source_remove(box._map.get(id).interval);
box._map.get(id).interval = undefined;
if (notif.interval) {
Utils.timeout(500, () => notif.destroy());
GLib.source_remove(notif.interval);
notif.interval = undefined;
}
}
});