Search code examples
c#monogtk#kiosk-mode

Run GTK# Application in Kiosk Mode


I am writing a C#/Mono app (GTK# GUI) for the Raspberry Pi. I want to run this app in kiosk mode (fullscreen, no metacity/ window borders, unable to exit). How does this work under Linux/Raspian? In Windows using WPF I can simply set the Window borderless and maximize it. I havn´t found a similar Property on the GTK-Window.


Solution

  • This works on OS-X, but I do not have a Linux box to double-check it right now, but it should be the same:

    using System;
    using Gtk;
    
    namespace GtkfullscreenNotdecorated
    {
        class MainClass
        {
            public static void Main (string[] args)
            {
                Application.Init ();
                MainWindow win = new MainWindow ();
                win.Show ();
                win.Fullscreen ();
                win.Decorated = false;
                Application.Run ();
            }
        }
    }
    

    The main thing is win.Fullscreen. In full screen, GTK2 window decoration is not visible, but I always add it. Run it with and without performing the win.Fullscreen() to see how your display manager is turning the decoration off.