Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Wayland support #50

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion sandwine/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ def parse_command_line(args):
action='store_true',
help='enable networking (default: networking disabled)')

wayland = parser.add_argument_group('wayland arguments')
wayland.add_argument('--wayland',
action='store_true',
help='enable use of host wayland (default: wayland disabled)')

sound = parser.add_argument_group('sound arguments')
sound.add_argument('--pulseaudio',
action='store_true',
Expand Down Expand Up @@ -273,14 +278,21 @@ def create_bwrap_argv(config):
if config.pulseaudio:
pulseaudio_socket = f'/run/user/{os.getuid()}/pulse/native'
env_tasks['PULSE_SERVER'] = f'unix:{pulseaudio_socket}'
mount_tasks += [MountTask(MountMode.BIND_RW, pulseaudio_socket)]
mount_tasks += [MountTask(MountMode.BIND_RO, pulseaudio_socket)]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this works in practice, it will be misleading because audio is read and written. So I would ask to revert this change, for the sake of clarity and realistic expectations (even before testing). We can discuss changing it more if there are good reasons but that should be a dedicated issue and or pull request then. Thank you!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im worried about program in sandbox may able to replace and hijack the socket file if we dont ro-bind it. also ro-bind is suggested by someone else on here https://wiki.archlinux.org/title/Bubblewrap/Examples#Firefox

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im worried about program in sandbox may able to replace and hijack the socket file if we dont ro-bind it.

@rhjdvsgsgks I cannot think of a threat model where you trust the app with audio but not with the audio socket. Please help me understand what I'm missing.

also ro-bind is suggested by someone else on here https://wiki.archlinux.org/title/Bubblewrap/Examples#Firefox

I'm not against the change, I'm against not understanding it and merging things before I understand them. Maybe it just takes playing with socket files more. Maybe there's something for me to learn about socket file permissions here.


# X11
if X11Mode(config.x11) != X11Mode.NONE:
x11_unix_socket = X11Display(config.x11_display_number).get_unix_socket()
mount_tasks += [MountTask(MountMode.BIND_RW, x11_unix_socket)]
env_tasks['DISPLAY'] = f':{config.x11_display_number}'

# wayland
if config.wayland:
XDG_RUNTIME_DIR = os.environ['XDG_RUNTIME_DIR']
WAYLAND_DISPLAY = os.environ['WAYLAND_DISPLAY']
env_tasks['XDG_RUNTIME_DIR'] = XDG_RUNTIME_DIR
mount_tasks += [MountTask(MountMode.BIND_RO, f'{XDG_RUNTIME_DIR}/{WAYLAND_DISPLAY}')]

# Wine
run_winecfg = (X11Mode(config.x11) != X11Mode.NONE
and (config.configure or config.dotwine is None))
Expand Down