Skip to content

Commit 153a035

Browse files
committed
fix(app): Workaround for GNOME/Wayland resize bug.
* Force X11 backend on GNOME + Wayland to work around a Tauri/WRY bug: tauri-apps/tauri#10686
1 parent 3241568 commit 153a035

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src-tauri/src/main.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
22
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
33

4+
use std::env;
5+
46
use futures::lock::Mutex;
57

68
mod transport;
@@ -9,7 +11,25 @@ use transport::commands::{transport_close, transport_send_data, ActiveConnection
911
use transport::gatt::{gatt_connect, gatt_list_devices};
1012
use transport::serial::{serial_connect, serial_list_devices};
1113

14+
// Workaround for Tauri/WRY bug. See https://github.com/tauri-apps/tauri/issues/10686#issuecomment-2337395299
15+
#[cfg(target_os = "linux")]
16+
fn gnome_wayland_resize_fix() {
17+
if env::var("APPIMAGE").is_ok() || env::var("FLATPAK_ID").is_ok() {
18+
return;
19+
}
20+
21+
let desktop = env::var("XDG_CURRENT_DESKTOP")
22+
.unwrap_or_default()
23+
.to_lowercase();
24+
if desktop.contains("gnome") {
25+
env::set_var("GDK_BACKEND", "x11");
26+
}
27+
}
28+
1229
fn main() {
30+
#[cfg(target_os = "linux")]
31+
gnome_wayland_resize_fix();
32+
1333
tauri::Builder::default()
1434
.plugin(tauri_plugin_cli::init())
1535
.manage(ActiveConnection {

0 commit comments

Comments
 (0)