From 6d70446d17f1500d9549ef8f8845aa380fe4e5a0 Mon Sep 17 00:00:00 2001 From: Caleb Smith Date: Fri, 29 Mar 2024 15:23:55 -0500 Subject: [PATCH] More help with Steam Deck scaling --- book/src/troubleshooting.md | 8 +++++++- src/gui.rs | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/book/src/troubleshooting.md b/book/src/troubleshooting.md index 1ec964df..fc01eaa1 100644 --- a/book/src/troubleshooting.md +++ b/book/src/troubleshooting.md @@ -23,4 +23,10 @@ Solutions to some known problems follow: This happens on some systems, *particularly Steam Deck*, for unknown reasons, but can be fixed by setting the environment variable -`WINIT_X11_SCALE_FACTOR=1.0`. +`WINIT_X11_SCALE_FACTOR=1.0`. If you launch UKMM from the terminal, running +it as `WINIT_X11_SCALE_FACTOR=1.0 ukmm` from the UKMM folder will work. +Otherwise, you may try setting it in your `~/.profile` or `~/.Xprofile`, e.g. +by adding the line `export WINIT_X11_SCALE_FACTOR=1.0`. Also note that some +desktop environments contain tools for setting environment variables. If you +need help with this, ArchWiki has an [excellent article on the +topic](https://wiki.archlinux.org/title/environment_variables). diff --git a/src/gui.rs b/src/gui.rs index e0b8a36c..a2a77e4a 100644 --- a/src/gui.rs +++ b/src/gui.rs @@ -283,7 +283,8 @@ impl App { fn new(cc: &eframe::CreationContext) -> Self { if option_env!("UPDATE_PLATFORM").unwrap_or_default() == "steamdeck" { cc.egui_ctx.set_pixels_per_point( - option_env!("WINIT_X11_SCALE_FACTOR") + std::env::var("WINIT_X11_SCALE_FACTOR") + .ok() .and_then(|v| v.parse().ok()) .unwrap_or(1.0), );