Skip to content

Commit

Permalink
Add support for nested X11 based on Xvfb
Browse files Browse the repository at this point in the history
  • Loading branch information
hartwork committed Mar 1, 2023
1 parent e8bd749 commit f086ad8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ So what is shared with the application by default then?
**sandwine** features include:

- A focus on security, usability, transparency
- Support for nested X11 (X2Go nxagent (seamless), Xephyr, Xnest)
- Support for nested X11 (X2Go nxagent (seamless), Xephyr, Xnest, Xvfb)
- Support for PulseAudio


Expand Down
9 changes: 9 additions & 0 deletions sandwine/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class X11Mode(Enum):
NXAGENT = 'nxagent'
XEPHYR = 'xephyr'
XNEST = 'xnest'
XVFB = 'xvfb'
NONE = 'none'

@staticmethod
Expand Down Expand Up @@ -118,6 +119,11 @@ def parse_command_line(args):
action='store_const',
const=X11Mode.XNEST,
help='enable nested X11 using Xnest (default: X11 disabled)')
x11_args.add_argument('--xvfb',
dest='x11',
action='store_const',
const=X11Mode.XVFB,
help='enable nested X11 using Xvfb (default: X11 disabled)')
x11_args.add_argument('--host-x11-danger-danger',
dest='x11',
action='store_const',
Expand Down Expand Up @@ -196,6 +202,7 @@ def detect_nested():
['nxagent', X11Mode.NXAGENT],
['Xephyr', X11Mode.XEPHYR],
['Xnest', X11Mode.XNEST],
['Xvfb', X11Mode.XVFB],
]
for command, mode in tests:
if shutil.which(command) is not None:
Expand All @@ -217,6 +224,8 @@ def __enter__(self):
argv = ['Xnest', '-geometry', self._geometry]
elif X11Mode(self._config.x11) == X11Mode.NXAGENT:
argv = ['nxagent', '-nolisten', 'tcp', '-ac', '-noshmem', '-R']
elif X11Mode(self._config.x11) == X11Mode.XVFB:
argv = ['Xvfb', '-screen', '0', f'{self._geometry}x24', '-extension', 'MIT-SHM']
else:
assert False, f'X11 mode {self._config.x11} not supported'

Expand Down

0 comments on commit f086ad8

Please sign in to comment.