diff options
Diffstat (limited to 'internal/shim/wayland.go')
| -rw-r--r-- | internal/shim/wayland.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/internal/shim/wayland.go b/internal/shim/wayland.go new file mode 100644 index 00000000..05f04278 --- /dev/null +++ b/internal/shim/wayland.go @@ -0,0 +1,35 @@ +package shim + +import ( + "net" + "sync" +) + +// Wayland implements wayland mediation. +type Wayland struct { + // wayland socket path + Path string + + // wayland connection + *net.UnixConn + + connErr error + sync.Once + // wait for wayland client to exit + done chan struct{} +} + +func (wl *Wayland) Close() error { + wl.Do(func() { + close(wl.done) + wl.connErr = wl.UnixConn.Close() + }) + + return wl.connErr +} + +func NewWayland() *Wayland { + wl := new(Wayland) + wl.done = make(chan struct{}) + return wl +} |
