diff options
| author | Victor Kareh <[email protected]> | 2026-03-21 10:14:28 -0400 |
|---|---|---|
| committer | Victor Kareh <[email protected]> | 2026-03-22 17:33:59 -0400 |
| commit | 1f59db9705b487f6bbb3f64284c728b486a2a8e9 (patch) | |
| tree | 45598db049b4bcefc99893d7ab105e31fbdb2a4e | |
| parent | 8f19a38a5af8c25cad119efa8c8343d160299daa (diff) | |
| download | mate-notification-daemon-fix-critical-show-conditions.tar.bz2 mate-notification-daemon-fix-critical-show-conditions.tar.xz | |
daemon: Add force-display setting to override notification suppressionfix-critical-show-conditions
Add a new 'force-display' gsettings and checkbox that, when enabled,
shows all notifications regardless of urgency, fullscreen, or
screensaver state. Do Not Disturb still takes precedence.
Fixes #199
| -rw-r--r-- | data/org.mate.NotificationDaemon.gschema.xml.in | 5 | ||||
| -rw-r--r-- | src/capplet/mate-notification-properties.c | 3 | ||||
| -rw-r--r-- | src/capplet/mate-notification-properties.ui | 16 | ||||
| -rw-r--r-- | src/common/constants.h | 1 | ||||
| -rw-r--r-- | src/daemon/daemon.c | 12 |
5 files changed, 32 insertions, 5 deletions
diff --git a/data/org.mate.NotificationDaemon.gschema.xml.in b/data/org.mate.NotificationDaemon.gschema.xml.in index 80beac4..a28edc3 100644 --- a/data/org.mate.NotificationDaemon.gschema.xml.in +++ b/data/org.mate.NotificationDaemon.gschema.xml.in @@ -51,5 +51,10 @@ <summary>Enable notification history</summary> <description>When enabled, notifications are stored in history for later viewing. When disabled, no notification history is kept for privacy. Note: This only controls MATE's notification daemon storage; other applications may still have access to notifications through system logs or other means.</description> </key> + <key name="force-display" type="b"> + <default>false</default> + <summary>Force display all notifications</summary> + <description>When enabled, all notifications are shown regardless of urgency, fullscreen, or screensaver state. Do Not Disturb still takes precedence.</description> + </key> </schema> </schemalist> diff --git a/src/capplet/mate-notification-properties.c b/src/capplet/mate-notification-properties.c index f81dd2c..a12ff20 100644 --- a/src/capplet/mate-notification-properties.c +++ b/src/capplet/mate-notification-properties.c @@ -49,6 +49,7 @@ typedef struct { GtkWidget* timeout_spin; GtkWidget* persistence_checkbox; GtkWidget* countdown_checkbox; + GtkWidget* force_display_checkbox; NotifyNotification* preview1; NotifyNotification* preview2; @@ -502,6 +503,7 @@ static gboolean notification_properties_dialog_init(NotificationAppletDialog* di dialog->timeout_spin = GTK_WIDGET(gtk_builder_get_object(builder, "timeout_spin")); dialog->persistence_checkbox = GTK_WIDGET(gtk_builder_get_object(builder, "enable_persistence_check")); dialog->countdown_checkbox = GTK_WIDGET(gtk_builder_get_object(builder, "show_countdown_check")); + dialog->force_display_checkbox = GTK_WIDGET(gtk_builder_get_object(builder, "force_display_check")); g_object_unref (builder); @@ -518,6 +520,7 @@ static gboolean notification_properties_dialog_init(NotificationAppletDialog* di g_settings_bind (dialog->gsettings, GSETTINGS_KEY_DEFAULT_TIMEOUT, timeout_adjustment, "value", G_SETTINGS_BIND_DEFAULT); g_settings_bind (dialog->gsettings, GSETTINGS_KEY_ENABLE_PERSISTENCE, dialog->persistence_checkbox, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind (dialog->gsettings, GSETTINGS_KEY_SHOW_COUNTDOWN, dialog->countdown_checkbox, "active", G_SETTINGS_BIND_DEFAULT); + g_settings_bind (dialog->gsettings, GSETTINGS_KEY_FORCE_DISPLAY, dialog->force_display_checkbox, "active", G_SETTINGS_BIND_DEFAULT); notification_properties_dialog_setup_themes (dialog); notification_properties_dialog_setup_positions (dialog); diff --git a/src/capplet/mate-notification-properties.ui b/src/capplet/mate-notification-properties.ui index 9b461bf..0c802e5 100644 --- a/src/capplet/mate-notification-properties.ui +++ b/src/capplet/mate-notification-properties.ui @@ -347,6 +347,22 @@ <property name="position">2</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="force_display_check"> + <property name="label" translatable="yes">Force Display All Notifications</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="halign">start</property> + <property name="draw_indicator">True</property> + <property name="tooltip_text" translatable="yes">Show all notifications regardless of urgency, fullscreen, or screensaver state. Do Not Disturb still takes precedence.</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> </object> </child> </object> diff --git a/src/common/constants.h b/src/common/constants.h index 1a81977..972cd7f 100644 --- a/src/common/constants.h +++ b/src/common/constants.h @@ -32,6 +32,7 @@ #define GSETTINGS_KEY_ENABLE_PERSISTENCE "enable-persistence" #define GSETTINGS_KEY_SHOW_COUNTDOWN "show-countdown" #define GSETTINGS_KEY_HISTORY_ENABLED "history-enabled" +#define GSETTINGS_KEY_FORCE_DISPLAY "force-display" #define NOTIFICATION_BUS_NAME "org.freedesktop.Notifications" #define NOTIFICATION_BUS_PATH "/org/freedesktop/Notifications" diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index 4f1aa11..3cdd72d 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c @@ -1834,8 +1834,10 @@ static gboolean notify_daemon_notify_handler(NotifyDaemonNotifications *object, #endif /* HAVE_X11 */ /* fullscreen_window is assumed to be false on Wayland, as there is no trivial way to check */ + gboolean force_display = g_settings_get_boolean (daemon->gsettings, GSETTINGS_KEY_FORCE_DISPLAY); + /* If on DnD or screensaver, suppress and close notification */ - if (do_not_disturb || (screensaver_active (GTK_WIDGET (nw)) && urgency != URGENCY_CRITICAL)) + if (do_not_disturb || (!force_display && screensaver_active (GTK_WIDGET (nw)) && urgency != URGENCY_CRITICAL)) { _NotifyPendingClose *notification_data; @@ -1848,12 +1850,12 @@ static gboolean notify_daemon_notify_handler(NotifyDaemonNotifications *object, } else { - /* Show if critical or no fullscreen window */ - if (urgency == URGENCY_CRITICAL || !fullscreen_window) + /* Show if critical, force-display, or no fullscreen window */ + if (force_display || urgency == URGENCY_CRITICAL || !fullscreen_window) theme_show_notification (nw); - /* Play sound unless low urgency during fullscreen */ - if (sound_file != NULL && !(fullscreen_window && urgency == URGENCY_LOW)) + /* Play sound unless low urgency during fullscreen (when not force-display) */ + if (sound_file != NULL && (force_display || !(fullscreen_window && urgency == URGENCY_LOW))) sound_play_file (GTK_WIDGET (nw), sound_file); } |
