From 43e010bf47abb96ed406f12f88d543afa6f916bd Mon Sep 17 00:00:00 2001 From: dy0gu Date: Mon, 28 Jul 2025 12:46:40 +0100 Subject: [PATCH] feat: add option to disable the "Reloaded the configuration" notification --- src/apprt/gtk-ng/class/window.zig | 11 ++++++++++- src/apprt/gtk/Window.zig | 4 +++- src/config/Config.zig | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/apprt/gtk-ng/class/window.zig b/src/apprt/gtk-ng/class/window.zig index 91e65731b..e085529ca 100644 --- a/src/apprt/gtk-ng/class/window.zig +++ b/src/apprt/gtk-ng/class/window.zig @@ -961,7 +961,16 @@ pub const Window = extern struct { _: *gobject.ParamSpec, self: *Self, ) callconv(.c) void { - self.addToast(i18n._("Reloaded the configuration")); + // We only toast if configured to + const priv = self.private(); + const config_obj = priv.config orelse { + self.syncAppearance(); + return; + }; + const config = config_obj.get(); + if (config.@"app-notifications".@"config-reload") { + self.addToast(i18n._("Reloaded the configuration")); + } self.syncAppearance(); } diff --git a/src/apprt/gtk/Window.zig b/src/apprt/gtk/Window.zig index 2f026e33c..d3408e867 100644 --- a/src/apprt/gtk/Window.zig +++ b/src/apprt/gtk/Window.zig @@ -772,7 +772,9 @@ pub fn focusCurrentTab(self: *Window) void { } pub fn onConfigReloaded(self: *Window) void { - self.sendToast(i18n._("Reloaded the configuration")); + if (self.app.config.@"app-notifications".@"config-reload") { + self.sendToast(i18n._("Reloaded the configuration")); + } } pub fn sendToast(self: *Window, title: [*:0]const u8) void { diff --git a/src/config/Config.zig b/src/config/Config.zig index d8fcfa1d7..637cfee49 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -2499,6 +2499,8 @@ keybind: Keybinds = .{}, /// /// - `clipboard-copy` (default: true) - Show a notification when text is copied /// to the clipboard. +/// - `config-reload` (default: true) - Show a notification when +/// the configuration is reloaded. /// /// To specify a notification to enable, specify the name of the notification. /// To specify a notification to disable, prefix the name with `no-`. For @@ -7058,6 +7060,7 @@ pub const GtkTitlebarStyle = enum(c_int) { /// See app-notifications pub const AppNotifications = packed struct { @"clipboard-copy": bool = true, + @"config-reload": bool = true, }; /// See bell-features