diff --git a/hosts/wim/config/ags/js/notifications/base.js b/hosts/wim/config/ags/js/notifications/base.js index 77c09ee5..39d54399 100644 --- a/hosts/wim/config/ags/js/notifications/base.js +++ b/hosts/wim/config/ags/js/notifications/base.js @@ -87,7 +87,10 @@ const NotificationIcon = notif => { }); }; -export default ({ notif, command = () => {} } = {}) => { +export default ({ + notif, + command = () => {}, +} = {}) => { const BlockedApps = [ 'Spotify', ]; diff --git a/hosts/wim/config/ags/js/notifications/gesture.js b/hosts/wim/config/ags/js/notifications/gesture.js index 32a51e9e..87f727bc 100644 --- a/hosts/wim/config/ags/js/notifications/gesture.js +++ b/hosts/wim/config/ags/js/notifications/gesture.js @@ -76,12 +76,12 @@ export default ({ if (offset >= 0) { self.setStyle(`margin-left: ${Number(offset + startMargin)}px; - margin-right: -${Number(offset + startMargin)}px;`); + margin-right: -${Number(offset + startMargin)}px;`); } else { offset = Math.abs(offset); self.setStyle(`margin-right: ${Number(offset + startMargin)}px; - margin-left: -${Number(offset + startMargin)}px;`); + margin-left: -${Number(offset + startMargin)}px;`); } self.get_parent()._dragging = Math.abs(offset) > 10; @@ -93,15 +93,16 @@ export default ({ [gesture, self => { if (!self._ready) { self.setStyle(`transition: margin 0.5s ease, opacity 0.5s ease; - margin-left: -${Number(maxOffset + endMargin)}px; - margin-right: ${Number(maxOffset + endMargin)}px; - margin-bottom: 0px; margin-top: 0px; opacity: 0;`); + margin-left: -${Number(maxOffset + endMargin)}px; + margin-right: ${Number(maxOffset + endMargin)}px; + margin-bottom: 0px; margin-top: 0px; opacity: 0;`); Utils.timeout(500, () => { 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-left: ${startMargin}px; + margin-right: ${startMargin}px; + margin-bottom: unset; margin-top: unset; + opacity: 1;`); }); Utils.timeout(1000, () => self._ready = true); return; @@ -125,9 +126,10 @@ export default ({ } else { 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-left: ${startMargin}px; + margin-right: ${startMargin}px; + margin-bottom: unset; margin-top: unset; + opacity: 1;`); if (widget.window) widget.window.set_cursor(Gdk.Cursor.new_from_name(display, 'grab')); diff --git a/hosts/wim/config/ags/js/notifications/popup.js b/hosts/wim/config/ags/js/notifications/popup.js index 2e27fd09..37967f80 100644 --- a/hosts/wim/config/ags/js/notifications/popup.js +++ b/hosts/wim/config/ags/js/notifications/popup.js @@ -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; } } });