From e5918ba3b3e2ed55f15a0ee750bc290a1dd571ed Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Mon, 9 Sep 2024 19:20:37 +0900 Subject: [PATCH] dbus/config: fix builtin defaults Signed-off-by: Ophestra Umiker --- dbus/config.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dbus/config.go b/dbus/config.go index 08441c1..5bbaa5c 100644 --- a/dbus/config.go +++ b/dbus/config.go @@ -56,15 +56,23 @@ func (c *Config) Args(address, path string) (args []string) { // NewConfig returns a reference to a Config struct with optional defaults. // If id is an empty string own defaults are omitted. func NewConfig(id string, defaults, mpris bool) (c *Config) { - c = &Config{Filter: true} + c = &Config{ + Call: make(map[string]string), + Broadcast: make(map[string]string), + + Filter: true, + } if defaults { - c.Talk = []string{"org.freedesktop.DBus", "org.freedesktop.portal.*", "org.freedesktop.Notifications"} + c.Talk = []string{"org.freedesktop.DBus", "org.freedesktop.Notifications"} + + c.Call["org.freedesktop.portal.*"] = "*" + c.Broadcast["org.freedesktop.portal.*"] = "@/org/freedesktop/portal/*" if id != "" { - c.Own = []string{id} + c.Own = []string{id + ".*"} if mpris { - c.Own = append(c.Own, "org.mpris.MediaPlayer2."+id) + c.Own = append(c.Own, "org.mpris.MediaPlayer2."+id+".*") } } }