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"),