Skip to content

Commit 60286d8

Browse files
committed
Support x-canonical-private-synchronous hint, which functions the same as wired-tag (#160).
1 parent 7736f3d commit 60286d8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/bus/dbus.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,20 @@ impl Notification {
446446
// A tag defines a certain type of notification, and allows it to be easily overriden using that tag.
447447
// A note is supplemental data passed to the notification. It's purely used for render
448448
// criteria stuff right now.
449-
let tag = arg::prop_cast::<String>(&hints, "wired-tag").cloned();
449+
let mut tag = arg::prop_cast::<String>(&hints, "wired-tag").cloned();
450450
let note = arg::prop_cast::<String>(&hints, "wired-note").cloned();
451451

452+
// We convert Canonical's special synchonous tag as if it was one of our own. The
453+
// functionality is the same. A decent overview: https://gitlab.freedesktop.org/xdg/xdg-specs/-/issues/77
454+
let canonical_synchronous = arg::prop_cast::<String>(&hints, "x-canonical-private-synchronous").cloned();
455+
456+
if tag.is_some() && canonical_synchronous.is_some() {
457+
// This is a bit weird.
458+
println!("Found both a `wired-tag` hint and a `x-canonical-private-synchronous` hint. These both do the same thing, so you probably only want one.");
459+
} else if canonical_synchronous.is_some() {
460+
tag = canonical_synchronous;
461+
}
462+
452463
let percentage: Option<f32>;
453464
if let Some(value) = arg::prop_cast::<i32>(&hints, "value") {
454465
// This should be ok since we only support values from 0 to 100.

0 commit comments

Comments
 (0)