From fb82bb4b8d316a0f1e432e9dadc2a206282cb4d6 Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Sun, 9 Aug 2026 14:54:54 +0800 Subject: [PATCH] fix: mark authentication windows as dialogs --- crates/auth/src/webview/webview_auth.rs | 5 +++++ crates/gpapi/src/utils/window.rs | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/crates/auth/src/webview/webview_auth.rs b/crates/auth/src/webview/webview_auth.rs index da71051..df043b1 100644 --- a/crates/auth/src/webview/webview_auth.rs +++ b/crates/auth/src/webview/webview_auth.rs @@ -1,6 +1,8 @@ use std::{sync::Arc, time::Duration}; use anyhow::bail; +#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))] +use gpapi::utils::window::{WindowTypeHint, set_window_type_hint}; use gpapi::{ auth::{AuthWindowTheme, AuthenticationCancelled, SamlAuthData}, gp_params::GpParams, @@ -156,6 +158,9 @@ impl<'a> WebviewAuthenticator<'a> { .center() .build()?; + #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))] + set_window_type_hint(&auth_window, WindowTypeHint::Dialog)?; + self .setup_auth_window(&auth_window, Arc::clone(&auth_messenger)) .await?; diff --git a/crates/gpapi/src/utils/window.rs b/crates/gpapi/src/utils/window.rs index 9e6ff25..5cc7f9c 100644 --- a/crates/gpapi/src/utils/window.rs +++ b/crates/gpapi/src/utils/window.rs @@ -1,5 +1,25 @@ use tauri::WebviewWindow; +#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum WindowTypeHint { + Dialog, + Utility, +} + +#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))] +pub fn set_window_type_hint(window: &WebviewWindow, hint: WindowTypeHint) -> anyhow::Result<()> { + use gtk::{gdk, traits::GtkWindowExt}; + + let hint = match hint { + WindowTypeHint::Dialog => gdk::WindowTypeHint::Dialog, + WindowTypeHint::Utility => gdk::WindowTypeHint::Utility, + }; + + window.gtk_window()?.set_type_hint(hint); + Ok(()) +} + /// Returns the frame-to-content height difference for a standard titled macOS window. /// This is nonzero only on macOS. pub fn get_title_bar_height() -> f64 {