diff --git a/quickshell/Modules/Notifications/Popup/NotificationPopup.qml b/quickshell/Modules/Notifications/Popup/NotificationPopup.qml index 30ac5b4e..d9a13d4d 100644 --- a/quickshell/Modules/Notifications/Popup/NotificationPopup.qml +++ b/quickshell/Modules/Notifications/Popup/NotificationPopup.qml @@ -42,6 +42,14 @@ PanelWindow { readonly property bool hasValidData: notificationData && notificationData.notification readonly property alias hovered: cardHoverHandler.hovered readonly property alias swipeActive: content.swipeActive + readonly property alias swipeDismissing: content.swipeDismissing + readonly property bool swipeDismissTowardEdge: { + if (content.swipeDismissing) + return _swipeDismissesTowardFrameEdge(); + if (content.swipeActive) + return content.swipeOffset * _frameEdgeSwipeDirection() > 0; + return false; + } property int screenY: 0 property bool exiting: false property bool _isDestroying: false @@ -432,15 +440,23 @@ PanelWindow { } function popupChromeReleaseProgress() { - if (exiting) - return Math.max(0, Math.min(1, Math.abs(_chromeMotionOffset()) / _chromeCardTravel())); + if (exiting) { + const exitRel = Math.max(0, Math.min(1, Math.abs(_chromeMotionOffset()) / _chromeCardTravel())); + if (content.swipeDismissing) { + const swipeRel = Math.max(0, Math.min(1, Math.abs(content.swipeOffset) / Math.max(1, content.swipeTravelDistance))); + return Math.max(exitRel, swipeRel); + } + return exitRel; + } if (content.swipeDismissing) return Math.max(0, Math.min(1, Math.abs(content.swipeOffset) / Math.max(1, content.swipeTravelDistance))); + if (content.swipeActive && content.swipeOffset * _frameEdgeSwipeDirection() > 0) + return Math.max(0, Math.min(1, Math.abs(content.swipeOffset) / Math.max(1, content.swipeTravelDistance))); return 0; } function popupChromeFollowsCardMotion() { - return content.swipeActive || (content.swipeDismissing && !exiting); + return false; } function popupChromeMotionX() { @@ -1059,7 +1075,7 @@ PanelWindow { const inwardConnectedExit = win.connectedFrameMode && !win.isCenterPosition && !win._swipeDismissesTowardFrameEdge(); if (inwardConnectedExit) content.chromeOnlyExit = true; - if (win.connectedFrameMode && (win.isCenterPosition || inwardConnectedExit)) { + if (win.connectedFrameMode) { win.startExit(); NotificationService.dismissNotification(notificationData); } else { diff --git a/quickshell/Modules/Notifications/Popup/NotificationPopupManager.qml b/quickshell/Modules/Notifications/Popup/NotificationPopupManager.qml index 691ad39c..e18597be 100644 --- a/quickshell/Modules/Notifications/Popup/NotificationPopupManager.qml +++ b/quickshell/Modules/Notifications/Popup/NotificationPopupManager.qml @@ -43,6 +43,7 @@ QtObject { popupComponent: Component { NotificationPopup { onExitFinished: manager._onPopupExitFinished(this) + onExitStarted: manager._onPopupExitStarted(this) onPopupHeightChanged: manager._onPopupHeightChanged(this) onPopupChromeGeometryChanged: manager._onPopupChromeGeometryChanged(this) } @@ -263,9 +264,14 @@ QtObject { } function _popupChromeVisibleFraction(p) { - if (p.exiting && p.popupChromeReleaseProgress) - return 1 - _chromeReleaseTailProgress(p.popupChromeReleaseProgress()); - if (!p.exiting && p.popupChromeOpenProgress) + if (p.popupChromeReleaseProgress) { + const rel = p.popupChromeReleaseProgress(); + if (p.exiting) + return Math.max(0, 1 - rel); + if (rel > 0) + return p.swipeDismissTowardEdge ? Math.max(0, 1 - rel) : 1 - _chromeReleaseTailProgress(rel); + } + if (p.popupChromeOpenProgress) return _clamp01(p.popupChromeOpenProgress()); return 1; } @@ -389,6 +395,7 @@ QtObject { ConnectedModeState.clearNotificationState(screenName); return; } + const trailing = chromeCandidates.length > 1 ? _trailingChromeWindow(chromeCandidates) : null; let active = chromeCandidates; if (chromeCandidates.length > 1) { @@ -396,6 +403,7 @@ QtObject { if (reserving.length > 0) active = reserving; } + let minX = Infinity; let minY = Infinity; let maxXEnd = -Infinity; @@ -449,6 +457,12 @@ QtObject { _repositionAll(); } + function _onPopupExitStarted(p) { + if (!p || popupWindows.indexOf(p) === -1) + return; + _repositionAll(); + } + function _onPopupExitFinished(p) { if (!p) return;