|
|
|
@ -224,6 +224,22 @@ func Run(privileged bool, detach bool, mounts []string, command []string) error
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sshAuthSock := os.Getenv("SSH_AUTH_SOCK")
|
|
|
|
|
|
|
|
|
|
if sshAuthSock == "" {
|
|
|
|
|
authSockGuess := "/run/user" + curUser.Uid + "/keyring/ssh"
|
|
|
|
|
if FileExists(authSockGuess) {
|
|
|
|
|
sshAuthSock = authSockGuess
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xdgRuntimeDir := os.Getenv("XDG_RUNTIME_DIR")
|
|
|
|
|
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", "WORKSPACE_DOCKER_GID="+dockerGroup.Gid,
|
|
|
|
@ -232,14 +248,16 @@ func Run(privileged bool, detach bool, mounts []string, command []string) error
|
|
|
|
|
"-v", "/etc/resolv.conf:/etc/resolv.conf:ro",
|
|
|
|
|
"-v", home+":"+home,
|
|
|
|
|
"-e", "SSH_AGENT_LAUNCHER="+os.Getenv("SSH_AGENT_LAUNCHER"),
|
|
|
|
|
"-e", "SSH_AUTH_SOCK="+os.Getenv("SSH_AUTH_SOCK"),
|
|
|
|
|
"-e", "SSH_AUTH_SOCK="+sshAuthSock,
|
|
|
|
|
"-e", "XDG_CURRENT_DESKTOP="+os.Getenv("XDG_CURRENT_DESKTOP"),
|
|
|
|
|
"-e", "DESKTOP_SESSION="+os.Getenv("DESKTOP_SESSION"),
|
|
|
|
|
"-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",
|
|
|
|
|
"-v", "/run/user/"+curUser.Uid+":/run/user/"+curUser.Uid,
|
|
|
|
|
"-v", "/dev/snd",
|
|
|
|
|
"-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"),
|
|
|
|
|
"-e", "WORKSPACE_USER="+curUser.Uid,
|
|
|
|
@ -394,6 +412,15 @@ func ToggleNightLight() error {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func FileExists(file string) bool {
|
|
|
|
|
_, err := os.Stat(file)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func EnsureDirectory(dir string) error {
|
|
|
|
|
if _, err := os.Stat(dir); os.IsNotExist(err) {
|
|
|
|
|
err = os.MkdirAll(dir, 0755)
|
|
|
|
|