From 62b7b30754fe2b1002b5298291083a2bc7d3ee73 Mon Sep 17 00:00:00 2001 From: bbedward Date: Mon, 22 Sep 2025 14:50:35 -0400 Subject: [PATCH] Suppress niri toasts on theme changes --- Common/Theme.qml | 2 +- Services/NiriService.qml | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Common/Theme.qml b/Common/Theme.qml index f428aee2..fd77b125 100644 --- a/Common/Theme.qml +++ b/Common/Theme.qml @@ -869,7 +869,7 @@ Singleton { onExited: exitCode => { if (exitCode === 0) { - if (typeof ToastService !== "undefined") { + if (typeof ToastService !== "undefined" && typeof NiriService !== "undefined" && !NiriService.matugenSuppression) { ToastService.showInfo("GTK colors applied successfully") } } else { diff --git a/Services/NiriService.qml b/Services/NiriService.qml index c6b464f7..0fcbcfcb 100644 --- a/Services/NiriService.qml +++ b/Services/NiriService.qml @@ -30,6 +30,7 @@ Singleton { property bool hasInitialConnection: false property bool suppressConfigToast: true property bool suppressNextConfigToast: false + property bool matugenSuppression: false readonly property string socketPath: Quickshell.env("NIRI_SOCKET") @@ -346,10 +347,12 @@ Singleton { if (ToastService.toastVisible && ToastService.currentLevel === ToastService.levelError) { ToastService.hideToast() } - if (hasInitialConnection && !suppressConfigToast && !suppressNextConfigToast) { + if (hasInitialConnection && !suppressConfigToast && !suppressNextConfigToast && !matugenSuppression) { ToastService.showInfo("niri: config reloaded") + } else if (suppressNextConfigToast) { + suppressNextConfigToast = false + suppressResetTimer.stop() } - suppressNextConfigToast = false } if (!hasInitialConnection) { @@ -496,7 +499,8 @@ Singleton { } function suppressNextToast() { - suppressNextConfigToast = true + matugenSuppression = true + suppressResetTimer.restart() } function findNiriWindow(toplevel) { @@ -595,4 +599,10 @@ Singleton { interval: 3000 onTriggered: root.suppressConfigToast = false } + + Timer { + id: suppressResetTimer + interval: 2000 + onTriggered: root.matugenSuppression = false + } }