
#!/bin/bash
# Allow your user inside the container to connect to Xwayland
xhost +si:localuser:$(whoami)

docker run -it --rm \
    --name ros2-container \
    --privileged \
    --device=/dev/dri:/dev/dri \
    --device=/dev/ttyUSB0 \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -v /run/user/$(id -u):/run/user/$(id -u) \
    -e DISPLAY=$DISPLAY \
    -e QT_X11_NO_MITSHM=1 \
    -v $(pwd)/ros2_ws:/home/rosuser/ros2_ws \
    -v $HOME/.Xauthority:/root/.Xauthority:ro \
    --user $(id -u):$(id -g) \
    --group-add video \
    --group-add dialout \
    --ipc=host \
    ros2-humble-gui

