GitHub Codespaces with VNC Support
GitHub Codespaces offers developers an instant, cloud-based development environment with a plethora of tools and utilities, all accessible directly from your browser. While it's perfect for many development tasks such as command line tools, Docker, or NodeJS, certain tasks, like those involving OpenGL rendering or Java Swing necessitate a graphical interface, which Codespaces lacks. However, with the help of a tool called Light-weight Desktop (desktop-lite), we can overcome this limitation.
Setting Up VNC Support with Desktop-lite
To enable VNC support in Codespaces, follow these steps:
- Navigate to the option “Configure dev container” from the Codespaces dropdown menu.
- Replace the existing JSON configuration with the following:
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
"ghcr.io/devcontainers/features/desktop-lite:1": {}
},
"forwardPorts": [6080],
"portsAttributes": {
"6080": {
"label": "desktop"
}
}
}
- Commit the changes and open the Codespaces environment. If prompted to rebuild the container to apply the changes, proceed with the rebuild.
- Click on the bottom icon labeled "Ports" and select the "Open in Browser" option.
- Use the default password
vscode
to connect.
- In the Settings, select the
Scaling Mode
toRemote Resizing
for a better user experience.
- You can now navigate to your project path as seen in VS Code by using the command ```bash
cd /workspaces/
Any changes made here will reflect in the VS Code environment seamlessly.
Top comments (3)
I am trying to run a java gui app in codespace, going through a browser. I have tried various things that have been suggested, and am getting an error like this: (other errors appeared before, but they disappeared)
Can't connect to X11 window server using 'localhost:0.0' as the value of the DISPLAY variable.
I have tried 10.0 instead of 0.0 with the same result.
When I follow these steps, it feels like like I am shooting in the dark. I have used Xming and putty to run java remotely on an Ubuntu terminal and have the display window on my windows machine. I undestand clearly how that works. Is there some document that explains what are all the entities that are at work here, and how this connection should work?
Have you solved the issue you have?
Sorry for the late reply didn't get any notification.
When I click on the globe I'm getting the following error
Any ideas?