hst/dbus: move dbus config struct
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m11s
Test / Hakurei (push) Successful in 3m12s
Test / Hpkg (push) Successful in 4m0s
Test / Hakurei (race detector) (push) Successful in 5m20s
Test / Sandbox (race detector) (push) Successful in 2m11s
Test / Flake checks (push) Successful in 1m31s

This allows holding a xdg-dbus-proxy configuration without importing system/dbus.

It also makes more sense in the project structure since the config struct is part of the hst API however the rest of the implementation is not.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-10-07 19:01:18 +09:00
parent 3ce63e95d7
commit d23b4dc9e6
17 changed files with 185 additions and 251 deletions

View File

@@ -6,7 +6,6 @@ import (
"time"
"hakurei.app/container"
"hakurei.app/system/dbus"
)
const Tmp = "/.hakurei"
@@ -42,10 +41,10 @@ type (
// Session D-Bus proxy configuration.
// If set to nil, session bus proxy assume built-in defaults.
SessionBus *dbus.Config `json:"session_bus,omitempty"`
SessionBus *BusConfig `json:"session_bus,omitempty"`
// System D-Bus proxy configuration.
// If set to nil, system bus proxy is disabled.
SystemBus *dbus.Config `json:"system_bus,omitempty"`
SystemBus *BusConfig `json:"system_bus,omitempty"`
// Direct access to wayland socket, no attempt is made to attach security-context-v1
// and the bare socket is made available to the container.
DirectWayland bool `json:"direct_wayland,omitempty"`

19
hst/dbus.go Normal file
View File

@@ -0,0 +1,19 @@
package hst
// BusConfig configures the xdg-dbus-proxy process.
type BusConfig struct {
// See set 'see' policy for NAME (--see=NAME)
See []string `json:"see"`
// Talk set 'talk' policy for NAME (--talk=NAME)
Talk []string `json:"talk"`
// Own set 'own' policy for NAME (--own=NAME)
Own []string `json:"own"`
// Call set RULE for calls on NAME (--call=NAME=RULE)
Call map[string]string `json:"call"`
// Broadcast set RULE for broadcasts from NAME (--broadcast=NAME=RULE)
Broadcast map[string]string `json:"broadcast"`
Log bool `json:"log,omitempty"`
Filter bool `json:"filter"`
}

View File

@@ -7,7 +7,6 @@ import (
"os"
"hakurei.app/container"
"hakurei.app/system/dbus"
)
// An AppError is returned while starting an app according to [hst.Config].
@@ -62,7 +61,7 @@ func Template() *Config {
Enablements: NewEnablements(EWayland | EDBus | EPulse),
SessionBus: &dbus.Config{
SessionBus: &BusConfig{
See: nil,
Talk: []string{"org.freedesktop.Notifications", "org.freedesktop.FileManager1", "org.freedesktop.ScreenSaver",
"org.freedesktop.secrets", "org.kde.kwalletd5", "org.kde.kwalletd6", "org.gnome.SessionManager"},
@@ -73,7 +72,7 @@ func Template() *Config {
Log: false,
Filter: true,
},
SystemBus: &dbus.Config{
SystemBus: &BusConfig{
See: nil,
Talk: []string{"org.bluez", "org.freedesktop.Avahi", "org.freedesktop.UPower"},
Own: nil,