feat: transient notification visibility (#170)
This commit is contained in:
@@ -110,7 +110,7 @@ config file to be able to detect config errors
|
|||||||
type: string ++
|
type: string ++
|
||||||
optional: false ++
|
optional: false ++
|
||||||
default: enabled ++
|
default: enabled ++
|
||||||
values: ignored, muted, enabled ++
|
values: ignored, muted, transient, enabled ++
|
||||||
description: The notification visibility state. ++
|
description: The notification visibility state. ++
|
||||||
*app-name*++
|
*app-name*++
|
||||||
type: string ++
|
type: string ++
|
||||||
|
@@ -137,7 +137,8 @@ namespace SwayNotificationCenter {
|
|||||||
public enum NotificationStatusEnum {
|
public enum NotificationStatusEnum {
|
||||||
ENABLED,
|
ENABLED,
|
||||||
MUTED,
|
MUTED,
|
||||||
IGNORED;
|
IGNORED,
|
||||||
|
TRANSIENT;
|
||||||
|
|
||||||
public string to_string () {
|
public string to_string () {
|
||||||
switch (this) {
|
switch (this) {
|
||||||
@@ -147,6 +148,8 @@ namespace SwayNotificationCenter {
|
|||||||
return "muted";
|
return "muted";
|
||||||
case IGNORED:
|
case IGNORED:
|
||||||
return "ignored";
|
return "ignored";
|
||||||
|
case TRANSIENT:
|
||||||
|
return "transient";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,6 +161,8 @@ namespace SwayNotificationCenter {
|
|||||||
return MUTED;
|
return MUTED;
|
||||||
case "ignored":
|
case "ignored":
|
||||||
return IGNORED;
|
return IGNORED;
|
||||||
|
case "transient":
|
||||||
|
return TRANSIENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -186,7 +186,7 @@
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The notification visibility state.",
|
"description": "The notification visibility state.",
|
||||||
"default": "enabled",
|
"default": "enabled",
|
||||||
"enum": ["ignored", "muted", "enabled"]
|
"enum": ["ignored", "muted", "enabled", "transient"]
|
||||||
},
|
},
|
||||||
"app-name": {
|
"app-name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@@ -172,16 +172,18 @@ namespace SwayNotificationCenter {
|
|||||||
synchronous_ids.set (param.synchronous, id);
|
synchronous_ids.set (param.synchronous, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only show popup notification if it is ENABLED
|
// Only show popup notification if it is ENABLED or TRANSIENT
|
||||||
if (state == NotificationStatusEnum.ENABLED
|
if ((state == NotificationStatusEnum.ENABLED || state == NotificationStatusEnum.TRANSIENT)
|
||||||
&& !control_center.get_visibility ()) {
|
&& !control_center.get_visibility ()) {
|
||||||
if (param.urgency == UrgencyLevels.CRITICAL ||
|
if (param.urgency == UrgencyLevels.CRITICAL ||
|
||||||
(!dnd && param.urgency != UrgencyLevels.CRITICAL)) {
|
(!dnd && param.urgency != UrgencyLevels.CRITICAL)) {
|
||||||
NotificationWindow.instance.add_notification (param, this);
|
NotificationWindow.instance.add_notification (param, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Only add notification to CC if it isn't IGNORED and not transient
|
// Only add notification to CC if it isn't IGNORED and not transient/TRANSIENT
|
||||||
if (state != NotificationStatusEnum.IGNORED && !param.transient) {
|
if (state != NotificationStatusEnum.IGNORED
|
||||||
|
&& state != NotificationStatusEnum.TRANSIENT
|
||||||
|
&& !param.transient) {
|
||||||
control_center.add_notification (param, this);
|
control_center.add_notification (param, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user