Skip to content

fix(mpris): match fully qualified D-Bus signal names in the watcher - #46

Merged
bethropolis merged 1 commit into
bethropolis:mainfrom
Rishabh672003:fix/mpris-qualified-signal-names
Sep 27, 2026
Merged

bethropolis merged 1 commit into
bethropolis:mainfrom
Rishabh672003:fix/mpris-qualified-signal-names

Conversation

@Rishabh672003

Copy link
Copy Markdown
Contributor

godbus sets Signal.Name to interface.member — documented on the Signal type in v5.2.2
(conn.go: "The name member is given in 'interface.member' notation") and built as
Name: iface + "." + member. The D-Bus spec makes the INTERFACE header required for signals, so
the name is always qualified.

The switch in internal/plugins/mpris/watcher.go compared it against bare member names:

switch sig.Name {
case "NameOwnerChanged":
case "Seeked":
case "PropertiesChanged":
}

None of these can match, so handleNameOwnerChanged, handleSeeked and
handlePropertiesChanged never ran. This PR uses the qualified names:

  • org.freedesktop.DBus.NameOwnerChanged
  • org.mpris.MediaPlayer2.Player.Seeked
  • org.freedesktop.DBus.Properties.PropertiesChanged

Why it appeared to mostly work

The plugin's fallback paths covered for the dead signal path:

  • Players present at startup are listed directly, not via signals.
  • While a player is playing, the position poller re-reads state every position_interval
    (2 s), so pauses and track changes arrived up to 2 s late.
  • While all players are paused, the watchdog (watchdogInterval, 10 s) finds playback that
    started, so play-from-pause took up to ~10 s.
  • Players appearing/disappearing were only picked up by the reconcile that runs when the
    phone requests the player list, since NameOwnerChanged was never handled.

With this change, updates are signal-driven again and the poller and watchdog go back to being
backups.

Testing

  • A small program on godbus v5.2.2 against a live session bus printed exactly the three
    qualified names above for NameOwnerChanged, Seeked and PropertiesChanged.
  • go test ./... (with and without -race), the integration suite, go vet and gofmt all pass.

AI-assisted.

godbus reports Signal.Name as "interface.member" (e.g.
"org.freedesktop.DBus.Properties.PropertiesChanged"), but the watcher
switch compared against bare member names, so no case ever matched and
the PropertiesChanged, Seeked and NameOwnerChanged handlers never ran.

AI-assisted.
@bethropolis

Copy link
Copy Markdown
Owner

Thank you for catching this, I think with this i can finally remove the watchdog.

@bethropolis
bethropolis merged commit 7871e52 into bethropolis:main Sep 27, 2026
@Rishabh672003

Rishabh672003 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor Author

yeah the watchdog isn't needed now, also @bethropolis i found this bcz someone made a vicinae extension (vicinaehq/extensions#398 its not merged as of now) for it, which is really cool. maybe you could mention it in the readme or somewhere, so people can get a useful implementation of this project

Any way really cool project, thanks for your work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants