From f28d93bdfcde84b83a280e657e7fd4eab40953a1 Mon Sep 17 00:00:00 2001 From: Hugo Thunnissen Date: Mon, 12 Feb 2024 18:47:27 +0100 Subject: [PATCH] Only mount xdg_runtime_dir when its env var is set --- main.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 514d1f4..9012d2a 100644 --- a/main.go +++ b/main.go @@ -237,7 +237,17 @@ func Run(privileged bool, detach bool, mounts []string, command []string) error waylandDisplay := os.Getenv("WAYLAND_DISPLAY") if waylandDisplay != "" { // let's be a little forceful with wayland use if it's available - dockerCommand = append(dockerCommand, "-e", "GDK_BACKEND=wayland") + dockerCommand = append(dockerCommand, + "-e", "GDK_BACKEND=wayland", + "-e", "WAYLAND_DISPLAY="+waylandDisplay, + ) + } + + if xdgRuntimeDir != "" { + dockerCommand = append(dockerCommand, + "--mount", "type=bind,source="+xdgRuntimeDir+",target="+xdgRuntimeDir, + "-e", "XDG_RUNTIME_DIR="+xdgRuntimeDir, + ) } dockerCommand = append( @@ -254,9 +264,6 @@ func Run(privileged bool, detach bool, mounts []string, command []string) error "-e", "PULSE_SERVER=unix:/run/user/"+curUser.Uid+"/pulse/native", "-e", "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/"+curUser.Uid+"/bus", "-v", "/tmp/.X11-unix:/tmp/.X11-unix", - "-e", "WAYLAND_DISPLAY="+waylandDisplay, - "-e", "XDG_RUNTIME_DIR="+xdgRuntimeDir, - "--mount", "type=bind,source="+xdgRuntimeDir+",target="+xdgRuntimeDir, "-v", "/dev/snd:/dev/snd", "-e", "DISPLAY="+os.Getenv("DISPLAY"), "-e", "XAUTHORITY="+os.Getenv("XAUTHORITY"),