From cc726ad6d058fe1587c0c6be7eea1fd50d4e2479 Mon Sep 17 00:00:00 2001 From: fazzi <18248986+fxzzi@users.noreply.github.com> Date: Mon, 27 Apr 2026 20:50:51 +0100 Subject: [PATCH] NotificationOverlay: take reserved space into account (#14184) --- src/notification/NotificationOverlay.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/notification/NotificationOverlay.cpp b/src/notification/NotificationOverlay.cpp index 0c9ec08cf..204f230ba 100644 --- a/src/notification/NotificationOverlay.cpp +++ b/src/notification/NotificationOverlay.cpp @@ -124,7 +124,10 @@ CBox CNotificationOverlay::notificationDamageForMonitor(PHLMONITOR pMonitor) { if (!pMonitor || m_notifications.empty()) return {}; - float offsetY = NOTIF_OFFSET_Y; + const float reservedTop = pMonitor->m_reservedArea.top(); + const float reservedRight = pMonitor->m_reservedArea.right(); + + float offsetY = NOTIF_OFFSET_Y + reservedTop; float maxWidth = 0.F; static auto fontFamily = CConfigValue("misc:font_family"); @@ -145,8 +148,8 @@ CBox CNotificationOverlay::notificationDamageForMonitor(PHLMONITOR pMonitor) { maxWidth = NOTIFSIZE.x; } - return CBox{sc(pMonitor->m_position.x + pMonitor->m_size.x - maxWidth - NOTIF_DAMAGE_PAD_X), sc(pMonitor->m_position.y), sc(maxWidth + NOTIF_DAMAGE_PAD_X), - sc(offsetY + NOTIF_OFFSET_Y)}; + return CBox{sc(pMonitor->m_position.x + pMonitor->m_size.x - reservedRight - maxWidth - NOTIF_DAMAGE_PAD_X), sc(pMonitor->m_position.y + reservedTop), + sc(maxWidth + NOTIF_DAMAGE_PAD_X), sc(offsetY + NOTIF_OFFSET_Y - reservedTop)}; } SP CNotificationOverlay::addNotification(const std::string& text, const CHyprColor& color, const float timeMs, const eIcons icon, const float fontSize) { @@ -196,7 +199,10 @@ std::vector> CNotificationOverlay::getNotifications() const { } CBox CNotificationOverlay::drawNotifications(PHLMONITOR pMonitor) { - float offsetY = NOTIF_OFFSET_Y; + const float reservedTopPx = pMonitor->m_reservedArea.top() * pMonitor->m_scale; + const float reservedRightPx = pMonitor->m_reservedArea.right() * pMonitor->m_scale; + + float offsetY = NOTIF_OFFSET_Y + reservedTopPx; float maxWidth = 0; const auto MONSIZE = pMonitor->m_transformedSize; @@ -237,10 +243,10 @@ CBox CNotificationOverlay::drawNotifications(PHLMONITOR pMonitor) { // third rect (horiz, col) const float THIRDRECTPERC = std::clamp(elapsed / lifeMs, 0.F, 1.F); - const float firstRectX = MONSIZE.x - (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC; + const float firstRectX = MONSIZE.x - reservedRightPx - (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC; const float firstRectW = (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC; - const float secondRectX = MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC; + const float secondRectX = MONSIZE.x - reservedRightPx - NOTIFSIZE.x * SECONDRECTPERC; const float secondRectW = NOTIFSIZE.x * SECONDRECTPERC; CRectPassElement::SRectData bgData;