Unverified Commit 07f6aac0 authored by Anthony Ruhier's avatar Anthony Ruhier Committed by GitHub

Do not keep transient notifications in the CC (#121)

Fixes #120. Notifications can indicate in their hints that they should be transient. A transient notification is not persistent, therefore, respects this hint and do not stack transient notifications in the control center.
parent 50d2274f
......@@ -182,8 +182,8 @@ namespace SwayNotificationCenter {
noti_window.add_notification (param, this);
}
}
// Only add notification to CC if it isn't IGNORED
if (state != NotificationStatusEnum.IGNORED) {
// Only add notification to CC if it isn't IGNORED and not transient
if (state != NotificationStatusEnum.IGNORED && !param.transient) {
control_center.add_notification (param, this);
}
......
......@@ -83,6 +83,7 @@ namespace SwayNotificationCenter {
public string desktop_entry { get; set; }
public string category { get; set; }
public bool resident { get; set; }
public bool transient { get; set; }
public UrgencyLevels urgency { get; set; }
/** Replaces the old notification with the same value of:
* - x-canonical-private-synchronous
......@@ -226,6 +227,13 @@ namespace SwayNotificationCenter {
resident = hint_value.get_boolean ();
}
break;
case "transient":
if (hint_value.is_of_type (GLib.VariantType.BOOLEAN)) {
transient = hint_value.get_boolean ();
} else if (hint_value.is_of_type (GLib.VariantType.INT32)) {
transient = hint_value.get_int32 () == 1;
}
break;
case "urgency":
if (hint_value.is_of_type (GLib.VariantType.BYTE)) {
urgency = UrgencyLevels.from_value (hint_value.get_byte ());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment