diff --git a/man/swaync.5.scd b/man/swaync.5.scd index 6c3fffa..167f354 100644 --- a/man/swaync.5.scd +++ b/man/swaync.5.scd @@ -110,7 +110,7 @@ config file to be able to detect config errors type: string ++ optional: false ++ default: enabled ++ - values: ignored, muted, enabled ++ + values: ignored, muted, transient, enabled ++ description: The notification visibility state. ++ *app-name*++ type: string ++ diff --git a/src/configModel/configModel.vala b/src/configModel/configModel.vala index 9e1b7a7..294d40c 100644 --- a/src/configModel/configModel.vala +++ b/src/configModel/configModel.vala @@ -137,7 +137,8 @@ namespace SwayNotificationCenter { public enum NotificationStatusEnum { ENABLED, MUTED, - IGNORED; + IGNORED, + TRANSIENT; public string to_string () { switch (this) { @@ -147,6 +148,8 @@ namespace SwayNotificationCenter { return "muted"; case IGNORED: return "ignored"; + case TRANSIENT: + return "transient"; } } @@ -158,6 +161,8 @@ namespace SwayNotificationCenter { return MUTED; case "ignored": return IGNORED; + case "transient": + return TRANSIENT; } } } diff --git a/src/configSchema.json b/src/configSchema.json index 5e9420a..273a52e 100644 --- a/src/configSchema.json +++ b/src/configSchema.json @@ -186,7 +186,7 @@ "type": "string", "description": "The notification visibility state.", "default": "enabled", - "enum": ["ignored", "muted", "enabled"] + "enum": ["ignored", "muted", "enabled", "transient"] }, "app-name": { "type": "string", diff --git a/src/notiDaemon/notiDaemon.vala b/src/notiDaemon/notiDaemon.vala index 60fafdd..a29ce76 100644 --- a/src/notiDaemon/notiDaemon.vala +++ b/src/notiDaemon/notiDaemon.vala @@ -172,16 +172,18 @@ namespace SwayNotificationCenter { synchronous_ids.set (param.synchronous, id); } - // Only show popup notification if it is ENABLED - if (state == NotificationStatusEnum.ENABLED + // Only show popup notification if it is ENABLED or TRANSIENT + if ((state == NotificationStatusEnum.ENABLED || state == NotificationStatusEnum.TRANSIENT) && !control_center.get_visibility ()) { if (param.urgency == UrgencyLevels.CRITICAL || (!dnd && param.urgency != UrgencyLevels.CRITICAL)) { NotificationWindow.instance.add_notification (param, this); } } - // Only add notification to CC if it isn't IGNORED and not transient - if (state != NotificationStatusEnum.IGNORED && !param.transient) { + // Only add notification to CC if it isn't IGNORED and not transient/TRANSIENT + if (state != NotificationStatusEnum.IGNORED + && state != NotificationStatusEnum.TRANSIENT + && !param.transient) { control_center.add_notification (param, this); }