Files
RedBear-OS/local
vasilito 25cb25c373 statusnotifierwatcher: fix bus name, identity collision, and unregister signals
Three defects from the 5-lane review of commit 4522bc39ca:

1. Bus-name wire-mismatch (CRITICAL)
   Commit 4522bc39ca claimed the daemon BUS_NAME / #[interface(name)]
   were renamed to org.kde.StatusNotifierWatcher. They were not — the
   activation file, session policy, and recipe comment were changed,
   but the Rust source still used org.freedesktop.StatusNotifierWatcher.
   At runtime, D-Bus activation fires for org.kde but the daemon
   registers org.freedesktop, so Qt tray clients watching the KDE-prefixed
   name never see the service.

   Fix: change const BUS_NAME (line 17) and #[interface(name = ...)]
   (line 298) to org.kde.StatusNotifierWatcher. Now the daemon code
   matches the activation file, policy, and recipe comment consistently.

2. Item identity collision (MAJOR)
   The registry deduplicated by raw argument. Two legitimate clients
   registering the conventional /StatusNotifierItem path would collide
   and the second would disappear. Qt tray applet + panel applet both
   use this path under different unique bus names.

   Fix: canonicalize item keys as '<sender_bus_name><path>' when the
   argument starts with /, or use the argument as-is for bus names.
   Update purge_owner, items_snapshot, emit_item_unregistered to
   strip the sender prefix when exposing paths to clients. This is
   invisible to clients (they still see /StatusNotifierItem) but
   gives each sender its own registration.

3. Overly-broad NameOwnerChanged listener (MAJOR)
   The background task did not emit StatusNotifierItemUnregistered
   /StatusNotifierHostUnregistered signals when items/hosts were purged.

   Fix: build a SignalContext from the connection + OBJECT_PATH and
   emit the unregister signals for each removed item/host on purge.
   Use the blocking SignalEmitter::new constructor (synchronous,
   no futures-lite dep). Already-failed purge (no items) is a no-op.

Also: the listener now ignores events where args.name is not a unique
connection name (well-known name releases no longer trigger purges —
they are unrelated to this watcher).

Verified by host cargo test: 29/29 tests pass (was 26, +3 new:
  - well_known_name_release_does_not_trigger_purge
  - two_clients_register_same_path_under_different_senders_both_registered
  - purge_emits_unregister_signals)
2026-07-28 07:20:48 +09:00
..