mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Add small env fixes for Ally
Signed-off-by: Luke Jones <luke@ljones.dev>
This commit is contained in:
@@ -35,10 +35,21 @@ async fn main() -> Result<()> {
|
||||
// If we're running under gamescope we have to set WAYLAND_DISPLAY for winit to
|
||||
// use
|
||||
if let Ok(gamescope) = env::var("GAMESCOPE_WAYLAND_DISPLAY") {
|
||||
dbg!(1);
|
||||
if !gamescope.is_empty() {
|
||||
dbg!(2);
|
||||
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
|
||||
{
|
||||
@@ -92,7 +103,7 @@ async fn main() -> Result<()> {
|
||||
let board_name = dmi.board_name;
|
||||
let prod_family = dmi.product_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();
|
||||
|
||||
@@ -163,6 +174,32 @@ async fn main() -> Result<()> {
|
||||
thread::spawn(move || {
|
||||
let mut state = AppState::StartingUp;
|
||||
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
|
||||
if let Ok(app_state) = app_state.lock() {
|
||||
state = *app_state;
|
||||
@@ -207,8 +244,9 @@ async fn main() -> Result<()> {
|
||||
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);
|
||||
let fullscreen = config
|
||||
.lock()
|
||||
.is_ok_and(|c| c.start_fullscreen);
|
||||
if fullscreen && !w.window().is_fullscreen() {
|
||||
w.window().set_fullscreen(fullscreen);
|
||||
}
|
||||
@@ -234,6 +272,7 @@ async fn main() -> Result<()> {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
slint::run_event_loop_until_quit().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user