From f773c92411b657be10c7a70d25e53bc18dff66b4 Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Sat, 7 Dec 2024 19:45:37 +0900 Subject: 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 --- internal/system/wayland.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'internal/system') 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])) -- cgit v1.3.1