In embedded Linux there is a very common demand for "kiosk" full screen mode applications. In this article I show you how to launch your Uno Platform Skia.GTK
app in full screen mode.
There is a way to do this using the UWP API, for example by setting the ApplicationView.PreferredLaunchWindowingMode
right at App.xaml.cs
constructor:
// namespace rerefence
using Windows.UI.ViewManagement;
ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
But in Uno Platform the PreferredLaunchWindowingMode
is not implemented.
⚠️ Maybe in the future this could be implemented, so it would be the recommended way to use it.
What remains is to use the ApplicationView.TryEnterFullScreenMode()
call:
ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
⚠️ It is important that this is called at the end ofOnLaunched
ofApp.xaml.cs
, or more specifically after_window.Activate();
. So, we will have an active "current view".
Done, your Uno Skia.GTK
application will be launched in full screen now.
Well, this works great if you are using Uno only for Skia.GTK
applications on Embedded Linux, and if that need to run in kiosk mode. However, if you are using it for cross-platform applications, which will support other backends, platforms, that do not need to run in kiosk mode, this will be a problem.
There are two ways to resolve this. Using the HAS_UNO_SKIA_GTK
constant:
#if HAS_UNO_SKIA_GTK
ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
#endif
So, the FullScreenMode
only will be applied to the Skia.GTK
project.
But, let's suppose you want to run this application also on Linux but in "normal" desktop mode. We can use an environment variable to have more control over this:
if (Environment.GetEnvironmentVariable("UNO_FULLSCREEN") != null)
{
ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
}