work around Gnome focus-stealing prevention

This commit is contained in:
Joseph Montanaro
2023-11-09 14:24:44 -08:00
parent 4e2a90b15b
commit 040a01536a
2 changed files with 21 additions and 5 deletions

View File

@ -108,6 +108,10 @@ async fn setup(app: &mut App) -> Result<(), Box<dyn Error>> {
setup_errors.push("Failed to register hotkeys. Hotkey settings have been disabled.".into());
}
let desktop_is_gnome = std::env::var("XDG_CURRENT_DESKTOP")
.map(|names| names.split(':').any(|n| n == "GNOME"))
.unwrap_or(false);
// if session is empty, this is probably the first launch, so don't autohide
if !conf.start_minimized || is_first_launch {
app.get_window("main")
@ -115,7 +119,7 @@ async fn setup(app: &mut App) -> Result<(), Box<dyn Error>> {
.show()?;
}
let state = AppState::new(conf, session, pool, setup_errors);
let state = AppState::new(conf, session, pool, setup_errors, desktop_is_gnome);
app.manage(state);
Ok(())
}