aboutsummaryrefslogtreecommitdiffhomepage
path: root/hst/enablement.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-12-07 22:33:45 +0900
committerOphestra <cat@gensokyo.uk>2025-12-07 22:34:40 +0900
commit1931b5460034b63dcb1c89bd0c8825a751829f45 (patch)
tree9132bd77d9b4bb128c7604232483d278e592b86f /hst/enablement.go
parent093e30c78872a5d8605de4b2a3aeb35abca63835 (diff)
hst: add pipewire flag
These are for #26. None of them are implemented yet. This fixes up test cases for the change to happen. Existing source code and JSON configuration continue to have the same effect. Existing flags get its EPulse bit replaced by EPipeWire. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst/enablement.go')
-rw-r--r--hst/enablement.go25
1 files changed, 17 insertions, 8 deletions
diff --git a/hst/enablement.go b/hst/enablement.go
index 7a1056d1..9024078d 100644
--- a/hst/enablement.go
+++ b/hst/enablement.go
@@ -17,6 +17,8 @@ const (
EX11
// EDBus enables the per-container xdg-dbus-proxy daemon.
EDBus
+ // EPipeWire exposes a pipewire pathname socket via SecurityContext.
+ EPipeWire
// EPulse copies the PulseAudio cookie to [hst.PrivateTmp] and exposes the PulseAudio socket.
EPulse
@@ -35,6 +37,8 @@ func (e Enablement) String() string {
return "x11"
case EDBus:
return "dbus"
+ case EPipeWire:
+ return "pipewire"
case EPulse:
return "pulseaudio"
default:
@@ -62,10 +66,11 @@ type Enablements Enablement
// enablementsJSON is the [json] representation of [Enablements].
type enablementsJSON = struct {
- Wayland bool `json:"wayland,omitempty"`
- X11 bool `json:"x11,omitempty"`
- DBus bool `json:"dbus,omitempty"`
- Pulse bool `json:"pulse,omitempty"`
+ Wayland bool `json:"wayland,omitempty"`
+ X11 bool `json:"x11,omitempty"`
+ DBus bool `json:"dbus,omitempty"`
+ PipeWire bool `json:"pipewire,omitempty"`
+ Pulse bool `json:"pulse,omitempty"`
}
// Unwrap returns the underlying [Enablement].
@@ -81,10 +86,11 @@ func (e *Enablements) MarshalJSON() ([]byte, error) {
return nil, syscall.EINVAL
}
return json.Marshal(&enablementsJSON{
- Wayland: Enablement(*e)&EWayland != 0,
- X11: Enablement(*e)&EX11 != 0,
- DBus: Enablement(*e)&EDBus != 0,
- Pulse: Enablement(*e)&EPulse != 0,
+ Wayland: Enablement(*e)&EWayland != 0,
+ X11: Enablement(*e)&EX11 != 0,
+ DBus: Enablement(*e)&EDBus != 0,
+ PipeWire: Enablement(*e)&EPipeWire != 0,
+ Pulse: Enablement(*e)&EPulse != 0,
})
}
@@ -108,6 +114,9 @@ func (e *Enablements) UnmarshalJSON(data []byte) error {
if v.DBus {
ve |= EDBus
}
+ if v.PipeWire {
+ ve |= EPipeWire
+ }
if v.Pulse {
ve |= EPulse
}