Maximize the window automatically when running in gamescope or Steam Big Picture

This commit is contained in:
Sebastian Krzyszkowiak
2026-10-27 03:07:01 +01:00
parent 2befefb547
commit 22c51ddf3c

View File

@@ -38,7 +38,7 @@ public partial class MainWindow : Window
ExtendClientAreaToDecorationsHint = true; ExtendClientAreaToDecorationsHint = true;
ExtendClientAreaTitleBarHeightHint = TitleBarHeight; ExtendClientAreaTitleBarHeightHint = TitleBarHeight;
if (AppServices.Current.Settings.WindowMaximized) if (AppServices.Current.Settings.WindowMaximized || wantsMaximized())
WindowState = WindowState.Maximized; WindowState = WindowState.Maximized;
PropertyChanged += (_, e) => PropertyChanged += (_, e) =>
@@ -309,6 +309,19 @@ public partial class MainWindow : Window
menu.Open(HelpButton); menu.Open(HelpButton);
} }
private bool wantsMaximized()
{
// make sure the window fills the whole screen on gamescope sessions
if (Environment.GetEnvironmentVariable("XDG_CURRENT_DESKTOP") == "gamescope")
return true;
// catch being launched via Steam Big Picture mode as well
if (Environment.GetEnvironmentVariable("SteamGamepadUI") == "1")
return true;
return false;
}
private void linkClick(object? sender, RoutedEventArgs e) private void linkClick(object? sender, RoutedEventArgs e)
{ {
if (sender is not Button btn) if (sender is not Button btn)
@@ -627,6 +640,6 @@ public partial class MainWindow : Window
if (!IsVisible) if (!IsVisible)
Show(); Show();
if (WindowState == WindowState.Minimized) if (WindowState == WindowState.Minimized)
WindowState = WindowState.Normal; WindowState = wantsMaximized() ? WindowState.Maximized : WindowState.Normal;
} }
} }