summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAylur <[email protected]>2024-09-17 15:37:16 +0000
committerAylur <[email protected]>2024-09-17 15:37:16 +0000
commit21cd759d61073066fee9b5a22f14c5fadb9d5c8e (patch)
tree0d7377b774d85e52a3e4ba3d6d0a21f0cd1f8d46
parente240676a48e8ec13cdb7839b1198654ba03bc679 (diff)
fix(notifications): urgency getter
-rw-r--r--lib/notifd/notification.vala16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/notifd/notification.vala b/lib/notifd/notification.vala
index 66eaccd..74b428e 100644
--- a/lib/notifd/notification.vala
+++ b/lib/notifd/notification.vala
@@ -33,7 +33,7 @@ public class AstalNotifd.Notification : Object {
public bool transient { get { return get_bool_hint("transient"); } }
public int x { get { return get_int_hint("x"); } }
public int y { get { return get_int_hint("y"); } }
- public Urgency urgency { get { return get_hint("urgency").get_byte(); } }
+ public Urgency urgency { get { return get_byte_hint("urgency"); } }
internal Notification(
string app_name,
@@ -81,6 +81,20 @@ public class AstalNotifd.Notification : Object {
return hints.contains(hint) ? hints.get(hint).get_int32() : 0;
}
+ public uint8 get_byte_hint(string hint) {
+ if (!hints.contains(hint))
+ return 0;
+
+ var v = hints.get(hint);
+ if (v.get_type_string() == "b")
+ return v.get_byte();
+
+ if (v.get_type_string() == "x")
+ return (uint8)v.get_int64();
+
+ return 0;
+ }
+
public signal void resolved(ClosedReason reason);
public signal void dismissed();
public signal void invoked(string action);