Toast: proper scaling + brought back assignation to WlrLayer.Overlay so its above all.

This commit is contained in:
LemmyCook 2025-09-01 15:03:30 -04:00
parent 87067f7062
commit 57d912efc8
3 changed files with 18 additions and 10 deletions

View file

@ -163,7 +163,7 @@ Rectangle {
Loader {
id: trayMenu
source: "../Extras/TrayMenu.qml"
source: "../Extras/TrayMenu.qml"
}
}
}

View file

@ -12,6 +12,7 @@ Variants {
delegate: Loader {
required property ShellScreen modelData
property real scaling: ScalingService.getScreenScale(modelData)
Connections {
target: ScalingService
function onScaleChanged(screenName, scale) {
@ -34,28 +35,29 @@ Variants {
anchors {
top: Settings.data.bar.position === "top"
bottom: Settings.data.bar.position === "bottom"
left: true
right: true
}
// Set a width instead of anchoring left/right so we can click on the side of the toast
implicitWidth: 500 * scaling
// Small height when hidden, appropriate height when visible
implicitHeight: Math.round(toast.visible ? toast.height + Style.marginM * scaling : 1)
// Set margins based on bar position
margins.top: Settings.data.bar.position === "top" ? (Style.barHeight + Style.marginS) * scaling : 0
margins.bottom: Settings.data.bar.position === "bottom" ? (Style.barHeight + Style.marginS) * scaling : 0
// Small height when hidden, appropriate height when visible
implicitHeight: toast.visible ? toast.height + Style.marginS * scaling : 1
// Transparent background
color: Color.transparent
// High layer to appear above other panels
//WlrLayershell.layer: WlrLayer.Overlay
// Overlay layer to appear above other panels
WlrLayershell.layer: WlrLayer.Overlay
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
exclusionMode: PanelWindow.ExclusionMode.Ignore
NToast {
id: toast
scaling: scaling
screen: modelData
// Simple positioning - margins already account for bar
targetY: Style.marginS * scaling

View file

@ -2,8 +2,10 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Effects
import Quickshell
import qs.Commons
import qs.Widgets
import qs.Services
Item {
id: root
@ -14,7 +16,8 @@ Item {
property int duration: 5000 // Auto-hide after 5 seconds, 0 = no auto-hide
property bool persistent: false // If true, requires manual dismiss
property real scaling: 1.0 // Will be set by parent
required property ShellScreen screen
property real scaling: 1.0
// Animation properties
property real targetY: 0
@ -31,6 +34,9 @@ Item {
z: 1000 // High z-index to appear above everything
function show() {
// NToast updates its scaling when showing.
scaling = ScalingService.getScreenScale(screen)
visible = true
showAnimation.start()
if (duration > 0 && !persistent) {