aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/system/pipewire.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-12-10 03:01:30 +0900
committerOphestra <cat@gensokyo.uk>2025-12-10 03:01:30 +0900
commitb72d502f1c5568cd8f93c9142247fa0d94caece5 (patch)
tree85a71fe040304d950e41e3f3021330fb141c6ad7 /internal/system/pipewire.go
parentf8b3db3f6641f79cf1bf1bbb9aa28d6922afe422 (diff)
internal/outcome: populate instance metadata for PipeWire
These have similar semantics to equivalent Wayland security-context-v1 fields. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/system/pipewire.go')
-rw-r--r--internal/system/pipewire.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/internal/system/pipewire.go b/internal/system/pipewire.go
index 45b1e8ba..d04cae41 100644
--- a/internal/system/pipewire.go
+++ b/internal/system/pipewire.go
@@ -14,8 +14,8 @@ import (
// PipeWire maintains a pipewire socket with SecurityContext attached via [pipewire].
// The socket stops accepting connections once the pipe referred to by sync is closed.
// The socket is pathname only and is destroyed on revert.
-func (sys *I) PipeWire(dst *check.Absolute) *I {
- sys.ops = append(sys.ops, &pipewireOp{nil, dst})
+func (sys *I) PipeWire(dst *check.Absolute, appID, instanceID string) *I {
+ sys.ops = append(sys.ops, &pipewireOp{nil, dst, appID, instanceID})
return sys
}
@@ -23,6 +23,8 @@ func (sys *I) PipeWire(dst *check.Absolute) *I {
type pipewireOp struct {
scc io.Closer
dst *check.Absolute
+
+ appID, instanceID string
}
func (p *pipewireOp) Type() hst.Enablement { return Process }
@@ -56,6 +58,8 @@ func (p *pipewireOp) apply(sys *I) (err error) {
if p.scc, err = securityContext.BindAndCreate(p.dst.String(), pipewire.SPADict{
{Key: pipewire.PW_KEY_SEC_ENGINE, Value: "app.hakurei"},
+ {Key: pipewire.PW_KEY_SEC_APP_ID, Value: p.appID},
+ {Key: pipewire.PW_KEY_SEC_INSTANCE_ID, Value: p.instanceID},
{Key: pipewire.PW_KEY_ACCESS, Value: "restricted"},
}); err != nil {
return newOpError("pipewire", err, false)
@@ -92,7 +96,9 @@ func (p *pipewireOp) revert(sys *I, _ *Criteria) error {
func (p *pipewireOp) Is(o Op) bool {
target, ok := o.(*pipewireOp)
return ok && p != nil && target != nil &&
- p.dst.Is(target.dst)
+ p.dst.Is(target.dst) &&
+ p.appID == target.appID &&
+ p.instanceID == target.instanceID
}
func (p *pipewireOp) Path() string { return p.dst.String() }