dbus/config: fix builtin defaults

Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
Ophestra Umiker 2024-09-09 19:20:37 +09:00
parent 35d040590b
commit e5918ba3b3
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q
1 changed files with 12 additions and 4 deletions

View File

@ -56,15 +56,23 @@ func (c *Config) Args(address, path string) (args []string) {
// NewConfig returns a reference to a Config struct with optional defaults. // NewConfig returns a reference to a Config struct with optional defaults.
// If id is an empty string own defaults are omitted. // If id is an empty string own defaults are omitted.
func NewConfig(id string, defaults, mpris bool) (c *Config) { 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 { 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 != "" { if id != "" {
c.Own = []string{id} c.Own = []string{id + ".*"}
if mpris { if mpris {
c.Own = append(c.Own, "org.mpris.MediaPlayer2."+id) c.Own = append(c.Own, "org.mpris.MediaPlayer2."+id+".*")
} }
} }
} }