Set CWD of desktop environment to CWD of notebook

Otherwise it'll be cwd of webroot, which is confusing as
soon as you open a terminal
This commit is contained in:
YuviPanda 2019-11-19 11:06:53 -08:00
parent 3ee7d7eb1d
commit 360f9b04c5
1 changed files with 14 additions and 8 deletions

View File

@ -1,4 +1,5 @@
import os
import shlex
import tempfile
@ -9,6 +10,17 @@ def setup_desktop():
# This is only readable, writeable & searchable by our uid
sockets_dir = tempfile.mkdtemp()
sockets_path = os.path.join(sockets_dir, 'vnc-socket')
vnc_command = ' '.join((shlex.quote(p) for p in [
os.path.join(HERE, 'share/tigervnc/bin/vncserver'),
'-verbose',
'-xstartup', os.path.join(HERE, 'share/xstartup'),
'-geometry', '1680x1050',
'-SecurityTypes', 'None',
'-rfbunixpath', sockets_path,
'-fg',
':1',
]))
return {
'command': [
'websockify', '-v',
@ -17,14 +29,8 @@ def setup_desktop():
'5901',
'--unix-target', sockets_path,
'--',
os.path.join(HERE, 'share/tigervnc/bin/vncserver'),
'-verbose',
'-xstartup', os.path.join(HERE, 'share/xstartup'),
'-geometry', '1680x1050',
'-SecurityTypes', 'None',
'-rfbunixpath', sockets_path,
'-fg',
':1',
'/bin/sh', '-c',
f'cd {os.getcwd()} && {vnc_command}'
],
'port': 5901,
'timeout': 30,