Search code examples
c#user-interfacemonoraspberry-pimonodevelop

Start a mono app fullscreen on a raspberry


I written a small app to create a UI on a small 320x240 touch screen. so far the app seems to work well, but I was wondering if I can start that app after booting with startx BUT then in fullscreen without the taskbar! It should give the user a simple UI like a kiosk mode for a browser or something. I used VS2012 on a Win7 system using C# and windows forms. the exe is compiled on mono with ubuntu and works well on my raspberrypi :-)


Solution

  • you can do this. but first configure the Pi to boot on the console and not boot to the GUI (X).

    then do the following on the console:

    sudo nano /etc/rc.local
    

    put these commands in the /etc/rc.local file:

    export DISPLAY=:0
    X -nocursor -s 0 -dpms&
    mono /home/pi/YourApp.exe&
    

    the above commands sets the environment variable DISPLAY to :0 which YourApp.exe will use to connect to the X server that was started on the second line.

    the X server is started with an invisible cursor and will not sleep or blank out.

    finally, you should set your App's main form settings as follows:

    this.FormBorderStyle = FormBorderStyle.None;
    this.WindowState = FormWindowState.Maximized;
    

    i hope this helps.