quickshell: toast hugs the clock's frame band instead of floating

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-08-17 11:56:18 +01:00
parent 4f89af16db
commit 62adfd2bcb

View file

@ -2265,15 +2265,12 @@ in
? Qt.vector4d(surfLeftX + chrome.width / 2, (panelTop + panelBottom) / 2, ? Qt.vector4d(surfLeftX + chrome.width / 2, (panelTop + panelBottom) / 2,
meltInto / 2 + chrome.width / 2, (panelBottom - panelTop) / 2) meltInto / 2 + chrome.width / 2, (panelBottom - panelTop) / 2)
: Qt.vector4d(0, 0, 0, 0) : Qt.vector4d(0, 0, 0, 0)
// Toast melts into whichever frame band it lands against // Toast melts into the band it sits against toastItem
// same snap test the panel uses, since the toast now // picks the side, this just buries the matching edge.
// follows the clock instead of sitting at the top. readonly property real toastTop: toastItem.atBottom
readonly property real toastRawTop: toastItem.y + 8 ? toastItem.y + 8 : meltTop
readonly property real toastRawBot: toastRawTop + _toastRect.height readonly property real toastBot: toastItem.atBottom
readonly property real toastTop: toastRawTop <= Theme.frameWidth + snapDist ? meltBot : toastItem.y + 8 + _toastRect.height
? meltTop : toastRawTop
readonly property real toastBot: toastRawBot >= bar.height - Theme.frameWidth - snapDist
? meltBot : toastRawBot
property vector4d toast: toastItem.visible && _toastRect.width > 0.5 property vector4d toast: toastItem.visible && _toastRect.width > 0.5
? Qt.vector4d(surfLeftX + _toastRect.width / 2, (toastTop + toastBot) / 2, ? Qt.vector4d(surfLeftX + _toastRect.width / 2, (toastTop + toastBot) / 2,
meltInto / 2 + _toastRect.width / 2, (toastBot - toastTop) / 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 var mutedApps: ["discord", "Discord", "Vesktop", "vesktop", "Spotify", "spotify", "spotify_player", "spotify-player", "vlc", "mpv"]
readonly property bool isPrimary: bar.screen === Quickshell.screens[0] 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 x: Theme.barWidth
// Hangs off the clock, exactly like the calendar popup // Flush to that band (it melts into it), never centred on
// (same clamp as BarDropdown). Move the clock in the bar // the clock a short toast floating mid-column reads as a
// column and both the popup and the toast follow it. // stray card instead of a surface growing out of the frame.
y: { y: Math.round(atBottom
const c = clockText.mapToItem(bar.contentItem, 0, clockText.height / 2).y; ? bar.height - Theme.frameWidth - height - 8
return Math.round(Math.max(Theme.frameWidth, : Theme.frameWidth + 8)
Math.min(bar.height - Theme.frameWidth - height, c - height / 2)));
}
width: _toastRect.width + 4 width: _toastRect.width + 4
height: _toastRect.height + 16 height: _toastRect.height + 16