aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/system/dbus/config.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-11-15 13:47:09 +0900
committerOphestra <cat@gensokyo.uk>2025-11-15 13:58:34 +0900
commita91920310d20e1fc472dea044fce8fd9438835df (patch)
tree378cba47d8586e798130a2855f91a685e05244a3 /internal/system/dbus/config.go
parent16e674782abbda8c85eac2e7d0c5c22e8cfbf5de (diff)
internal: relocate packages
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/system/dbus/config.go')
-rw-r--r--internal/system/dbus/config.go71
1 files changed, 0 insertions, 71 deletions
diff --git a/internal/system/dbus/config.go b/internal/system/dbus/config.go
deleted file mode 100644
index 2a09ee90..00000000
--- a/internal/system/dbus/config.go
+++ /dev/null
@@ -1,71 +0,0 @@
-package dbus
-
-import (
- "hakurei.app/hst"
-)
-
-// ProxyPair is an upstream dbus address and a downstream socket path.
-type ProxyPair [2]string
-
-// Args returns the xdg-dbus-proxy arguments equivalent of [hst.BusConfig].
-func Args(c *hst.BusConfig, bus ProxyPair) (args []string) {
- argc := 2 + len(c.See) + len(c.Talk) + len(c.Own) + len(c.Call) + len(c.Broadcast)
- if c.Log {
- argc++
- }
- if c.Filter {
- argc++
- }
-
- args = make([]string, 0, argc)
- args = append(args, bus[0], bus[1])
- if c.Filter {
- args = append(args, "--filter")
- }
- for _, name := range c.See {
- args = append(args, "--see="+name)
- }
- for _, name := range c.Talk {
- args = append(args, "--talk="+name)
- }
- for _, name := range c.Own {
- args = append(args, "--own="+name)
- }
- for name, rule := range c.Call {
- args = append(args, "--call="+name+"="+rule)
- }
- for name, rule := range c.Broadcast {
- args = append(args, "--broadcast="+name+"="+rule)
- }
- if c.Log {
- args = append(args, "--log")
- }
-
- return
-}
-
-// NewConfig returns the address of a new [hst.BusConfig] with optional defaults.
-func NewConfig(id string, defaults, mpris bool) *hst.BusConfig {
- c := hst.BusConfig{
- Call: make(map[string]string),
- Broadcast: make(map[string]string),
-
- Filter: true,
- }
-
- if defaults {
- 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 + ".*"}
- if mpris {
- c.Own = append(c.Own, "org.mpris.MediaPlayer2."+id+".*")
- }
- }
- }
-
- return &c
-}