aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/system
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-12-07 19:45:37 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-12-07 19:45:37 +0900
commitf773c92411b657be10c7a70d25e53bc18dff66b4 (patch)
tree52589593239d1e7e045e1a04a6fc5d2455b22f0d /internal/system
parent16ab734fcdb43a0e3936607316bd40638c9463ee (diff)
system: prevent duplicate Wayland op
Wayland is implemented as an Op to enforce dependency and cleanup, its implementation does not allow multiple instances on a single sys object, nor would doing that make any sense. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/system')
-rw-r--r--internal/system/wayland.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/system/wayland.go b/internal/system/wayland.go
index 36a7fa6d..9394aaab 100644
--- a/internal/system/wayland.go
+++ b/internal/system/wayland.go
@@ -32,6 +32,11 @@ func (w Wayland) Type() Enablement {
}
func (w Wayland) apply(sys *I) error {
+ // the Wayland op is not repeatable
+ if sys.sp != nil {
+ return errors.New("attempted to attach multiple wayland sockets")
+ }
+
if err := w.conn.Attach(w.pair[1]); err != nil {
return fmsg.WrapErrorSuffix(err,
fmt.Sprintf("cannot attach to wayland on %q:", w.pair[1]))