ConSol / docker-headless-vnc-container

Collection of Docker images with headless VNC environments
Apache License 2.0
1.73k stars 737 forks source link

where to add custom command that uses display? #163

Closed falcorocks closed 1 year ago

falcorocks commented 1 year ago

Hi, I love the image! I want the user to find a python GUI already open when they connect to the http server. The GUI starts with a python invocation (something like python3 /tmp/mygui/main.py...)

I'm trying to understand where I can place this invocation so that the GUI is already displayed when the user connects. I've tried to run it just before the startup.sh script, however the GUI is not showed in the display... Ideas?

falcorocks commented 1 year ago

Hey, I managed to achieve this by altering your vnc_startup.sh and adding my custom command at line 115 (after your echo -e "\nnoVNC HTML client started:\n\t=> connect via http://$VNC_IP:$NO_VNC_PORT/?password=...\n"). However it is not very elegant to override your script... I'm all ears if you have a better alternative!

sni commented 1 year ago

since it is a standard x window system, you might want to use the existing autostart features of those window managers? However, it would of course be nice to make something like that easier. Maybe add an optional "AUTOSTART_CMD" env variable which could be set in the container and the vnc_startup scripts runs that command if its set.