Skip to content

Commit

Permalink
Set CWD of desktop environment to CWD of notebook
Browse files Browse the repository at this point in the history
Otherwise it'll be cwd of webroot, which is confusing as
soon as you open a terminal
  • Loading branch information
yuvipanda committed Nov 19, 2019
1 parent 3ee7d7e commit 360f9b0
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions jupyter_desktop/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import shlex
import tempfile


Expand All @@ -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',
Expand All @@ -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,
Expand Down

0 comments on commit 360f9b0

Please sign in to comment.