|
|
@ -2,9 +2,10 @@ package xpra
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"github.com/subgraph/oz"
|
|
|
|
|
|
|
|
"os"
|
|
|
|
"os"
|
|
|
|
"os/exec"
|
|
|
|
"os/exec"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/subgraph/oz"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var xpraServerDefaultArgs = []string{
|
|
|
|
var xpraServerDefaultArgs = []string{
|
|
|
@ -13,32 +14,39 @@ var xpraServerDefaultArgs = []string{
|
|
|
|
"--input-method=keep",
|
|
|
|
"--input-method=keep",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func NewServer(config *oz.XServerConf, display uint64, workdir string) *Xpra {
|
|
|
|
func NewServer(config *oz.XServerConf, display uint64, spath, workdir string) *Xpra {
|
|
|
|
x := new(Xpra)
|
|
|
|
x := new(Xpra)
|
|
|
|
x.Config = config
|
|
|
|
x.Config = config
|
|
|
|
x.Display = display
|
|
|
|
x.Display = display
|
|
|
|
x.WorkDir = workdir
|
|
|
|
x.WorkDir = workdir
|
|
|
|
x.xpraArgs = prepareServerArgs(config, display, workdir)
|
|
|
|
x.xpraArgs = prepareServerArgs(config, display, workdir)
|
|
|
|
x.Process = exec.Command("/usr/bin/xpra", x.xpraArgs...)
|
|
|
|
|
|
|
|
|
|
|
|
x.xpraArgs = append([]string{"-b", "/usr/bin/xpra"}, x.xpraArgs...)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
x.Process = exec.Command(spath, x.xpraArgs...)
|
|
|
|
x.Process.Env = append(os.Environ(),
|
|
|
|
x.Process.Env = append(os.Environ(),
|
|
|
|
"TMPDIR="+workdir,
|
|
|
|
"TMPDIR="+workdir,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err := writeFakeProfile(x.Process); err != nil {
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return x
|
|
|
|
return x
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func prepareServerArgs(config *oz.XServerConf, display uint64, workdir string) []string {
|
|
|
|
func prepareServerArgs(config *oz.XServerConf, display uint64, workdir string) []string {
|
|
|
|
args := getDefaultArgs(config)
|
|
|
|
args := getDefaultArgs(config)
|
|
|
|
args = append(args, xpraServerDefaultArgs...)
|
|
|
|
args = append(args, xpraServerDefaultArgs...)
|
|
|
|
args = append(args,
|
|
|
|
|
|
|
|
fmt.Sprintf("--socket-dir=%s", workdir),
|
|
|
|
|
|
|
|
"start",
|
|
|
|
|
|
|
|
fmt.Sprintf(":%d", display),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
if config.AudioMode == oz.PROFILE_AUDIO_FULL || config.AudioMode == oz.PROFILE_AUDIO_SPEAKER {
|
|
|
|
if config.AudioMode == oz.PROFILE_AUDIO_FULL || config.AudioMode == oz.PROFILE_AUDIO_SPEAKER {
|
|
|
|
args = append(args, "--pulseaudio")
|
|
|
|
args = append(args, "--pulseaudio")
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
args = append(args, "--no-pulseaudio")
|
|
|
|
args = append(args, "--no-pulseaudio")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
args = append(args,
|
|
|
|
|
|
|
|
fmt.Sprintf("--socket-dir=%s", workdir),
|
|
|
|
|
|
|
|
"start",
|
|
|
|
|
|
|
|
fmt.Sprintf(":%d", display),
|
|
|
|
|
|
|
|
)
|
|
|
|
return args
|
|
|
|
return args
|
|
|
|
}
|
|
|
|
}
|
|
|
|