Avalonia: Fullscreen not working on macOS or Linux

Created on 21 Jul 2019  路  8Comments  路  Source: AvaloniaUI/Avalonia

I have a very simple app that I want to run full screen. I can't seem to get it to work on either my mac dev machine or the linux (raspberry pi) machine that I am running it on.

WindowState="Maximized"

and setting

this.HasSystemDecorations = false;
this.WindowState = WindowState.Maximized;
this.Topmost = true;
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;

On the MainWindow.xaml(.cs) doesn't seem to work at all. It does hide system decorations and jump to the screen, but it's not fullscreen.

enhancement linux osx

All 8 comments

On X11 the full screen mode can not be achieved by combination of the lack of decorations and maximizing (_NET_WM_STATE_MAXIMIZED_VERT+_NET_WM_STATE_MAXIMIZED_HORZ) the window. A separate _NET_WM_STATE_FULLSCREEN state is required.

On OSX, I believe, we need NSWindow::toggleFullscreen

I think the full screen mode should be represented by a separate window state.

Yeah, if it could just be a window state, then a check within that to determine which OS it is running on and do the appropriate command

if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) //_NET_WM_STATE_FULLSCREEN

So when developing you don't need to care what OS it will run on.

Is there a way to set _NET_WM_STATE_FULLSCREEN manually in dotnet core code?

For now you can copy-paste SendNetWMMessage and required classes and use it like this. XID is available via this.PlatformImpl.Handle.Handle.

Thanks! I'll try that.

Does exist any new approach ?

We now have WindowState = FullScreen.

The Fullscreen option doesn't show up in the possible choices for me and even if I set it, it doesn't compile.

The Fullscreen option doesn't show up in the possible choices for me and even if I set it, it doesn't compile.

It's only in pre-release at this point.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

akunchev picture akunchev  路  3Comments

grokys picture grokys  路  4Comments

JonathaN7Shepard picture JonathaN7Shepard  路  4Comments

Urgau picture Urgau  路  3Comments

x2bool picture x2bool  路  4Comments