From 62adfd2bcba62cec1b2bd4179b4b57033a45c707 Mon Sep 17 00:00:00 2001 From: rope Date: Mon, 17 Aug 2026 11:56:18 +0100 Subject: [PATCH] quickshell: toast hugs the clock's frame band instead of floating Co-Authored-By: Claude Opus 5 --- settings/quickshell.nix | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/settings/quickshell.nix b/settings/quickshell.nix index 0e80bee..7dab244 100644 --- a/settings/quickshell.nix +++ b/settings/quickshell.nix @@ -2265,15 +2265,12 @@ in ? Qt.vector4d(surfLeftX + chrome.width / 2, (panelTop + panelBottom) / 2, meltInto / 2 + chrome.width / 2, (panelBottom - panelTop) / 2) : Qt.vector4d(0, 0, 0, 0) - // Toast melts into whichever frame band it lands against — - // same snap test the panel uses, since the toast now - // follows the clock instead of sitting at the top. - readonly property real toastRawTop: toastItem.y + 8 - readonly property real toastRawBot: toastRawTop + _toastRect.height - readonly property real toastTop: toastRawTop <= Theme.frameWidth + snapDist - ? meltTop : toastRawTop - readonly property real toastBot: toastRawBot >= bar.height - Theme.frameWidth - snapDist - ? meltBot : toastRawBot + // Toast melts into the band it sits against — toastItem + // picks the side, this just buries the matching edge. + readonly property real toastTop: toastItem.atBottom + ? toastItem.y + 8 : meltTop + readonly property real toastBot: toastItem.atBottom + ? meltBot : toastItem.y + 8 + _toastRect.height property vector4d toast: toastItem.visible && _toastRect.width > 0.5 ? Qt.vector4d(surfLeftX + _toastRect.width / 2, (toastTop + toastBot) / 2, meltInto / 2 + _toastRect.width / 2, (toastBot - toastTop) / 2) @@ -7143,15 +7140,20 @@ in readonly property var mutedApps: ["discord", "Discord", "Vesktop", "vesktop", "Spotify", "spotify", "spotify_player", "spotify-player", "vlc", "mpv"] readonly property bool isPrimary: bar.screen === Quickshell.screens[0] + // Which frame band the toast lives against: the one the + // clock sits nearest, so it lands on the same side as the + // calendar popup the clock opens. Move the clock in the + // column and both follow. The shader reads this too. + readonly property bool atBottom: + clockText.mapToItem(bar.contentItem, 0, clockText.height / 2).y > bar.height / 2 + x: Theme.barWidth - // Hangs off the clock, exactly like the calendar popup - // (same clamp as BarDropdown). Move the clock in the bar - // column and both the popup and the toast follow it. - y: { - const c = clockText.mapToItem(bar.contentItem, 0, clockText.height / 2).y; - return Math.round(Math.max(Theme.frameWidth, - Math.min(bar.height - Theme.frameWidth - height, c - height / 2))); - } + // Flush to that band (it melts into it), never centred on + // the clock — a short toast floating mid-column reads as a + // stray card instead of a surface growing out of the frame. + y: Math.round(atBottom + ? bar.height - Theme.frameWidth - height - 8 + : Theme.frameWidth + 8) width: _toastRect.width + 4 height: _toastRect.height + 16