1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 07:52:50 -05:00

Suppress niri toasts on theme changes

This commit is contained in:
bbedward
2025-09-22 14:50:35 -04:00
parent aa52b586d6
commit 62b7b30754
2 changed files with 14 additions and 4 deletions

View File

@@ -869,7 +869,7 @@ Singleton {
onExited: exitCode => { onExited: exitCode => {
if (exitCode === 0) { if (exitCode === 0) {
if (typeof ToastService !== "undefined") { if (typeof ToastService !== "undefined" && typeof NiriService !== "undefined" && !NiriService.matugenSuppression) {
ToastService.showInfo("GTK colors applied successfully") ToastService.showInfo("GTK colors applied successfully")
} }
} else { } else {

View File

@@ -30,6 +30,7 @@ Singleton {
property bool hasInitialConnection: false property bool hasInitialConnection: false
property bool suppressConfigToast: true property bool suppressConfigToast: true
property bool suppressNextConfigToast: false property bool suppressNextConfigToast: false
property bool matugenSuppression: false
readonly property string socketPath: Quickshell.env("NIRI_SOCKET") readonly property string socketPath: Quickshell.env("NIRI_SOCKET")
@@ -346,10 +347,12 @@ Singleton {
if (ToastService.toastVisible && ToastService.currentLevel === ToastService.levelError) { if (ToastService.toastVisible && ToastService.currentLevel === ToastService.levelError) {
ToastService.hideToast() ToastService.hideToast()
} }
if (hasInitialConnection && !suppressConfigToast && !suppressNextConfigToast) { if (hasInitialConnection && !suppressConfigToast && !suppressNextConfigToast && !matugenSuppression) {
ToastService.showInfo("niri: config reloaded") ToastService.showInfo("niri: config reloaded")
} else if (suppressNextConfigToast) {
suppressNextConfigToast = false
suppressResetTimer.stop()
} }
suppressNextConfigToast = false
} }
if (!hasInitialConnection) { if (!hasInitialConnection) {
@@ -496,7 +499,8 @@ Singleton {
} }
function suppressNextToast() { function suppressNextToast() {
suppressNextConfigToast = true matugenSuppression = true
suppressResetTimer.restart()
} }
function findNiriWindow(toplevel) { function findNiriWindow(toplevel) {
@@ -595,4 +599,10 @@ Singleton {
interval: 3000 interval: 3000
onTriggered: root.suppressConfigToast = false onTriggered: root.suppressConfigToast = false
} }
Timer {
id: suppressResetTimer
interval: 2000
onTriggered: root.matugenSuppression = false
}
} }