Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run configurable MPD frontend when clicking notification #56

Open
Lassebq opened this issue Jun 7, 2024 · 2 comments
Open

Run configurable MPD frontend when clicking notification #56

Lassebq opened this issue Jun 7, 2024 · 2 comments

Comments

@Lassebq
Copy link

Lassebq commented Jun 7, 2024

eonpatapon/mpDris2#55

@rien333
Copy link

rien333 commented Sep 26, 2024

I'm trying to work on this right now, actually! @natsukagami will you accept PRs that implement this? I was thinking of letting users specify which .desktop file they use by an optional command line flag. If that flag is not specified, mpd-mpris will behave as it did before.

Currently, I use an ugly hack to achieve this for my prefered mpd client:

diff --git a/introspect.go b/introspect.go
index 63c688c..913f853 100644
--- a/introspect.go
+++ b/introspect.go
@@ -43,6 +43,11 @@ func (i *Instance) IntrospectNode() *introspect.Node {
 						Type:   "as",
 						Access: "read",
 					},
+					introspect.Property{
+						Name:   "DesktopEntry",
+						Type:   "as",
+						Access: "read",
+					},
 				},
 				Methods: []introspect.Method{
 					introspect.Method{

diff --git a/root.go b/root.go
index ad43163..767aed2 100644
--- a/root.go
+++ b/root.go
@@ -1,3 +1,3 @@
 package mpris
 
 import (
	"fmt"

 	"github.com/godbus/dbus/v5"
 	"github.com/godbus/dbus/v5/prop"
 )
@@ -19,7 +17,8 @@ func (m *MediaPlayer2) properties() map[string]*prop.Prop {
 		"CanQuit":      newProp(false, nil),                                            // https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:CanQuit
 		"CanRaise":     newProp(false, nil),                                            // https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:CanRaise
 		"HasTrackList": newProp(false, nil),                                            // https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:HasTrackList
-		"Identity":     newProp(fmt.Sprintf("MPD on %s", m.Instance.mpd.Address), nil), // https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:Identity
+		"Identity":     newProp("Plattenalbum", nil), // https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:Identity
+		"DesktopEntry":  newProp("de.wagnermartin.Plattenalbum", nil), // https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:DesktopEntry 		// Empty because we can't add arbitary files in...
 		"SupportedUriSchemes": newProp([]string{}, nil), // https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:SupportedUriSchemes
 		"SupportedMimeTypes":  newProp([]string{}, nil), // https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:SupportedMimeTypes

@natsukagami
Copy link
Owner

I was thinking of letting users specify which .desktop file they use by an optional command line flag.

This looks good. Something like a -desktop-entry flag would suffice; I'm not sure yet about modifying the identity, but I suppose it's ok too to have a flag to do that (at some point we might start getting a config file lol...)

I will welcome a PR!

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

No branches or pull requests

3 participants