Add small env fixes for Ally

Signed-off-by: Luke Jones <luke@ljones.dev>
This commit is contained in:
Luke Jones
2025-02-16 23:01:59 +13:00
parent f299ffeb6e
commit 5c3348a9f5

View File

@@ -35,10 +35,21 @@ async fn main() -> Result<()> {
// If we're running under gamescope we have to set WAYLAND_DISPLAY for winit to // If we're running under gamescope we have to set WAYLAND_DISPLAY for winit to
// use // use
if let Ok(gamescope) = env::var("GAMESCOPE_WAYLAND_DISPLAY") { if let Ok(gamescope) = env::var("GAMESCOPE_WAYLAND_DISPLAY") {
dbg!(1);
if !gamescope.is_empty() { if !gamescope.is_empty() {
dbg!(2);
env::set_var("WAYLAND_DISPLAY", gamescope); env::set_var("WAYLAND_DISPLAY", gamescope);
} }
// gamescope-0
else if let Ok(wayland) = env::var("WAYLAND_DISPLAY") {
dbg!(3);
if wayland.is_empty() {
dbg!(4);
env::set_var("WAYLAND_DISPLAY", "gamescope-0");
} }
}
}
dbg!("SHITR");
// Try to open a proxy and check for app state first // Try to open a proxy and check for app state first
{ {
@@ -92,7 +103,7 @@ async fn main() -> Result<()> {
let board_name = dmi.board_name; let board_name = dmi.board_name;
let prod_family = dmi.product_family; let prod_family = dmi.product_family;
info!("Running on {board_name}, product: {prod_family}"); info!("Running on {board_name}, product: {prod_family}");
let is_rog_ally = prod_family == "RC71L" || prod_family == "RC72L"; let is_rog_ally = board_name == "RC71L" || board_name == "RC72L" || prod_family == "ROG Ally";
let args: Vec<String> = args().skip(1).collect(); let args: Vec<String> = args().skip(1).collect();
@@ -163,6 +174,32 @@ async fn main() -> Result<()> {
thread::spawn(move || { thread::spawn(move || {
let mut state = AppState::StartingUp; let mut state = AppState::StartingUp;
loop { loop {
if is_rog_ally {
let config_copy_2 = config.clone();
let newui = setup_window(config.clone());
newui.window().on_close_requested(move || {
exit(0);
});
let ui_copy = newui.as_weak();
newui
.window()
.set_rendering_notifier(move |s, _| {
if let slint::RenderingState::BeforeRendering = s {
let config = config_copy_2.clone();
ui_copy
.upgrade_in_event_loop(move |w| {
let fullscreen =
config.lock().is_ok_and(|c| c.start_fullscreen);
if fullscreen && !w.window().is_fullscreen() {
w.window().set_fullscreen(fullscreen);
}
})
.ok();
}
})
.ok();
} else {
// save as a var, don't hold the lock the entire time or deadlocks happen // save as a var, don't hold the lock the entire time or deadlocks happen
if let Ok(app_state) = app_state.lock() { if let Ok(app_state) = app_state.lock() {
state = *app_state; state = *app_state;
@@ -207,8 +244,9 @@ async fn main() -> Result<()> {
let config = config_copy_2.clone(); let config = config_copy_2.clone();
ui_copy ui_copy
.upgrade_in_event_loop(move |w| { .upgrade_in_event_loop(move |w| {
let fullscreen = let fullscreen = config
config.lock().is_ok_and(|c| c.start_fullscreen); .lock()
.is_ok_and(|c| c.start_fullscreen);
if fullscreen && !w.window().is_fullscreen() { if fullscreen && !w.window().is_fullscreen() {
w.window().set_fullscreen(fullscreen); w.window().set_fullscreen(fullscreen);
} }
@@ -234,6 +272,7 @@ async fn main() -> Result<()> {
} }
} }
} }
}
}); });
slint::run_event_loop_until_quit().unwrap(); slint::run_event_loop_until_quit().unwrap();