diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index d9c7da2..fd6ef21 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -18,8 +18,8 @@ Variants { required property ShellScreen modelData readonly property real scaling: ScalingService.scale(modelData) - active: modelData ? (Settings.data.bar.monitors.includes(modelData.name) - || (Settings.data.bar.monitors.length === 0)) : false + active: Settings.isLoaded && modelData ? (Settings.data.bar.monitors.includes(modelData.name) + || (Settings.data.bar.monitors.length === 0)) : false sourceComponent: PanelWindow { screen: modelData diff --git a/Modules/Dock/Dock.qml b/Modules/Dock/Dock.qml index a045528..eba466c 100644 --- a/Modules/Dock/Dock.qml +++ b/Modules/Dock/Dock.qml @@ -17,7 +17,7 @@ Variants { required property ShellScreen modelData readonly property real scaling: ScalingService.scale(modelData) - active: modelData ? Settings.data.dock.monitors.includes(modelData.name) : false + active: Settings.isLoaded && modelData ? Settings.data.dock.monitors.includes(modelData.name) : false sourceComponent: PanelWindow { id: dockWindow diff --git a/Modules/Notification/Notification.qml b/Modules/Notification/Notification.qml index 707f26f..def931b 100644 --- a/Modules/Notification/Notification.qml +++ b/Modules/Notification/Notification.qml @@ -25,9 +25,10 @@ Variants { property var removingNotifications: ({}) // If no notification display activated in settings, then show them all - active: modelData ? (Settings.data.notifications.monitors.includes(modelData.name) - || (Settings.data.notifications.monitors.length === 0)) - && (NotificationService.notificationModel.count > 0) : false + active: Settings.isLoaded && modelData ? (Settings.data.notifications.monitors.includes(modelData.name) + || (Settings.data.notifications.monitors.length === 0)) : false + + visible: (NotificationService.notificationModel.count > 0) sourceComponent: PanelWindow { screen: modelData diff --git a/Modules/Toast/ToastManager.qml b/Modules/Toast/ToastManager.qml deleted file mode 100644 index 0da45c1..0000000 --- a/Modules/Toast/ToastManager.qml +++ /dev/null @@ -1,70 +0,0 @@ -import QtQuick -import QtQuick.Controls -import Quickshell -import Quickshell.Wayland -import qs.Commons -import qs.Services -import qs.Widgets - -// ToastManager creates toast overlays on each screen -Variants { - model: Quickshell.screens - - delegate: PanelWindow { - id: root - - required property ShellScreen modelData - readonly property real scaling: ScalingService.scale(screen) - screen: modelData - - // Only show on screens that have notifications enabled - visible: modelData ? (Settings.data.notifications.monitors.includes(modelData.name) - || (Settings.data.notifications.monitors.length === 0)) : false - - // Position based on bar location, like Notification popup does - anchors { - top: Settings.data.bar.position === "top" - bottom: Settings.data.bar.position === "bottom" - left: true - right: true - } - - // 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 - WlrLayershell.keyboardFocus: WlrKeyboardFocus.None - exclusionMode: PanelWindow.ExclusionMode.Ignore - - NToast { - id: toast - scaling: root.scaling - - // Simple positioning - margins already account for bar - targetY: Style.marginS * scaling - - // Hidden position based on bar location - hiddenY: Settings.data.bar.position === "top" ? -toast.height - 20 : toast.height + 20 - - Component.onCompleted: { - // Only register toasts for screens that have notifications enabled - if (modelData ? (Settings.data.notifications.monitors.includes(modelData.name) - || (Settings.data.notifications.monitors.length === 0)) : false) { - // Register this toast with the service - ToastService.allToasts.push(toast) - - // Connect dismissal signal - toast.dismissed.connect(ToastService.onToastDismissed) - } - } - } - } -} diff --git a/Modules/Toast/ToastOverlay.qml b/Modules/Toast/ToastOverlay.qml new file mode 100644 index 0000000..10b030b --- /dev/null +++ b/Modules/Toast/ToastOverlay.qml @@ -0,0 +1,68 @@ +import QtQuick +import QtQuick.Controls +import Quickshell +import Quickshell.Wayland +import qs.Commons +import qs.Services +import qs.Widgets + +Variants { + model: Quickshell.screens + + delegate: Loader { + required property ShellScreen modelData + readonly property real scaling: ScalingService.scale(modelData) + + // Only show on screens that have notifications enabled + active: Settings.isLoaded && modelData ? (Settings.data.notifications.monitors.includes(modelData.name) + || (Settings.data.notifications.monitors.length === 0)) : false + + sourceComponent: PanelWindow { + id: root + + screen: modelData + + // Position based on bar location, like Notification popup does + anchors { + top: Settings.data.bar.position === "top" + bottom: Settings.data.bar.position === "bottom" + left: true + right: true + } + + // 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 + WlrLayershell.keyboardFocus: WlrKeyboardFocus.None + exclusionMode: PanelWindow.ExclusionMode.Ignore + + NToast { + id: toast + scaling: scaling + + // Simple positioning - margins already account for bar + targetY: Style.marginS * scaling + + // Hidden position based on bar location + hiddenY: Settings.data.bar.position === "top" ? -toast.height - 20 : toast.height + 20 + + Component.onCompleted: { + // Register this toast with the service + ToastService.allToasts.push(toast) + + // Connect dismissal signal + toast.dismissed.connect(ToastService.onToastDismissed) + } + } + } + } +} diff --git a/Services/ToastService.qml b/Services/ToastService.qml index 5db7139..6c0be38 100644 --- a/Services/ToastService.qml +++ b/Services/ToastService.qml @@ -12,7 +12,7 @@ Singleton { property var messageQueue: [] property bool isShowingToast: false - // Reference to all toast instances (set by ToastManager) + // Reference to all toast instances (set by ToastOverlay) property var allToasts: [] // Properties for command checking @@ -197,6 +197,7 @@ Singleton { toast.type = toastData.type toast.persistent = toastData.persistent toast.duration = toastData.duration + toast.show() } } @@ -236,8 +237,4 @@ Singleton { } } } - - Component.onCompleted: { - - } } diff --git a/shell.qml b/shell.qml index 370b788..17103e0 100644 --- a/shell.qml +++ b/shell.qml @@ -48,7 +48,7 @@ ShellRoot { id: lockScreen } - ToastManager {} + ToastOverlay {} IPCManager {}