I have used a Xvnc server with a lightweight window manager to achieve something similar. Here is a setup that I have used. In my case I was running a Java program, so the last step might be different in your case.
Install Xvnc
Xvnc is a virtual framebuffer which can be used instead of real display (and mouse and keyboard). It also contains VNC server that allows to connect to the machine and see what it is displaying.
sudo apt-get install vnc4server
Install IceWM
IceWM is lightweight and the most stable window manager that I've tried.
The default option couldn't run my app properly, but it might be good enough for you. Here are some others I tried:
- matchbox-window-manager had an issue with mnemonics which I needed
- fluxbox had an issue with some dialog windows
To install IceWM along with themes (not sure if themes are needed) using apt-get:
sudo apt-get install icewm icewm-themes
Xvnc must be configured to run this manager. Change (or create the file if does not exist) the configuration file on the home directory ~/.vnc/xstartup:. Again this depends on what you need.
#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
icewm &
Install required libraries used by your app
Java needed some libraries that I believe come with the X server. These can be easily installed by the following commands. Note: some of these libraries might have been installed while trying different window managers, but I installed them manually beforehand.
sudo apt-get install libxrender1
sudo apt-get install libxtst6
sudo apt-get install libxi6 libgconf-2-4
Running your app
First set a password for vncserver. The command will ask for a password and verification of the password.
vncpasswd
The real display is identified in linux by a number and this number is made available to applications through the DISPLAY env variable. Set up the display and vncserver using these commands:
vncserver :10 -depth 16 -geometry 1600x900
Depth and geometry are the color depth and resolution parameters of the display.
Set the DISPLAY property:
export DISPLAY=:10
Run the app. You can now connect to the vnc if you want to see it.