From 78cfd96f3761acec8b23d8cb9be63313b97abb9a Mon Sep 17 00:00:00 2001 From: Philip Kristoffersen Date: Wed, 28 Dec 2022 12:20:43 +0100 Subject: [PATCH] Automatic fullscreen when starting from steam (#289) --- Cargo.lock | 2 +- Cargo.toml | 2 +- flatpak/io.github.philipk.boilr.appdata.xml | 9 ++++++++- src/ui/uiapp.rs | 10 +++++++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 84b3f3b..ae0e5e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -265,7 +265,7 @@ dependencies = [ [[package]] name = "boilr" -version = "1.7.10" +version = "1.7.11" dependencies = [ "base64 0.20.0", "chrono", diff --git a/Cargo.toml b/Cargo.toml index a7b72b0..88989f8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] edition = "2021" name = "boilr" -version = "1.7.10" +version = "1.7.11" [dependencies] base64 = "^0.20.0" diff --git a/flatpak/io.github.philipk.boilr.appdata.xml b/flatpak/io.github.philipk.boilr.appdata.xml index 7c099db..66643df 100644 --- a/flatpak/io.github.philipk.boilr.appdata.xml +++ b/flatpak/io.github.philipk.boilr.appdata.xml @@ -25,7 +25,14 @@ https://hughsie.github.io/oars/index.html --> - + + +
    +
  • Automatically go fullscreen when in steam mode
  • +
+
+
+
  • Only load platforms that are available for OS
  • diff --git a/src/ui/uiapp.rs b/src/ui/uiapp.rs index 3c7d2d3..e842d50 100644 --- a/src/ui/uiapp.rs +++ b/src/ui/uiapp.rs @@ -353,7 +353,7 @@ pub fn run_sync() { pub fn run_ui(args: Vec) { let app = MyEguiApp::new(); let no_v_sync = args.contains(&"--no-vsync".to_string()); - let fullscreen = args.contains(&"--fullscreen".to_string()); + let fullscreen = is_fullscreen(&args); let native_options = eframe::NativeOptions { fullscreen, maximized: true, @@ -371,3 +371,11 @@ pub fn run_ui(args: Vec) { }), ); } + +fn is_fullscreen(args: &Vec) -> bool { + let is_steam_mode = match std::env::var("SteamAppId") { + Ok(value) => !value.is_empty(), + Err(_) => false, + }; + is_steam_mode || args.contains(&"--fullscreen".to_string()) +}