Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(linux): keep native window decorations

t8y29298a0cc9362
diff --git a/apps/desktop/src/composables/useWindowControls.ts b/apps/desktop/src/composables/useWindowControls.ts
index 94e311151e..abc478c585 100644
--- a/apps/desktop/src/composables/useWindowControls.ts
+++ b/apps/desktop/src/composables/useWindowControls.ts
@@ -1,6 +1,6 @@
import { ref, onMounted, onUnmounted } from "vue";
import { isTauriRuntime } from "@/lib/tauriRuntime";
-import { isMacOS } from "@/lib/platform";
+import { isMacOS, isWindows } from "@/lib/platform";
export function shouldReserveMacTrafficLightInset(isMac: boolean, isFullscreen: boolean, isDesktop = true): boolean {
return isDesktop && isMac && !isFullscreen;
@@ -11,7 +11,7 @@ export function useWindowControls() {
const isFullscreen = ref(false);
const isMac = isMacOS();
const isDesktop = isTauriRuntime();
- const showControls = isDesktop && !isMac;
+ const showControls = isDesktop && isWindows();
let unlisten: (() => void) | null = null;
diff --git a/apps/desktop/src/lib/platform.ts b/apps/desktop/src/lib/platform.ts
index bb1e708464..4a50009c59 100644
--- a/apps/desktop/src/lib/platform.ts
+++ b/apps/desktop/src/lib/platform.ts
@@ -11,3 +11,7 @@ export function getPlatform(): Platform {
export function isMacOS(): boolean {
return getPlatform() === "macos";
}
+
+export function isWindows(): boolean {
+ return getPlatform() === "windows";
+}
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index f1601f480e..46f2b2c1ac 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -38,6 +38,20 @@ fn should_show_main_window_after_setup() -> bool {
true
}
+fn should_disable_native_window_decorations(target_os: &str) -> bool {
+ matches!(target_os, "windows")
+}
+
+#[cfg(target_os = "linux")]
+fn apply_linux_webkit_rendering_workarounds() {
+ const DISABLE_DMABUF_RENDERER: &str = "WEBKIT_DISABLE_DMABUF_RENDERER";
+ if std::env::var_os(DISABLE_DMABUF_RENDERER).is_none() {
+ // WebKitGTK's DMABUF renderer can produce a blank AppImage window on
+ // Fedora/Wayland/NVIDIA systems. This must be set before WebKit starts.
+ std::env::set_var(DISABLE_DMABUF_RENDERER, "1");
+ }
+}
+
fn show_main_window<R: tauri::Runtime>(app: &tauri::AppHandle<R>) {
if let Some(window) = app.get_webview_window("main") {
let _ = window.show();
@@ -172,7 +186,10 @@ pub(crate) fn apply_desktop_settings(app: &tauri::AppHandle, desktop_settings: &
#[cfg(test)]
#[allow(clippy::items_after_test_module)]
mod tests {
- use super::{should_hide_window_on_close, should_setup_desktop_tray, should_show_main_window_after_setup};
+ use super::{
+ should_disable_native_window_decorations, should_hide_window_on_close, should_setup_desktop_tray,
+ should_show_main_window_after_setup,
+ };
#[test]
fn hides_window_on_close_for_windows_and_macos() {
@@ -198,11 +215,20 @@ mod tests {
fn shows_main_window_after_regular_startup_setup() {
assert!(should_show_main_window_after_setup());
}
+
+ #[test]
+ fn disables_native_window_decorations_only_on_windows() {
+ assert!(should_disable_native_window_decorations("windows"));
+ assert!(!should_disable_native_window_decorations("linux"));
+ assert!(!should_disable_native_window_decorations("macos"));
+ }
}
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
rustls::crypto::aws_lc_rs::default_provider().install_default().expect("Failed to install rustls crypto provider");
+ #[cfg(target_os = "linux")]
+ apply_linux_webkit_rendering_workarounds();
let startup_begin = Instant::now();
@@ -297,8 +323,7 @@ pub fn run() {
commands::mcp_bridge::start(app_handle, state);
eprintln!("[STARTUP] setup complete in {:?} (total {:?})", setup_start.elapsed(), startup_begin.elapsed());
- #[cfg(not(target_os = "macos"))]
- {
+ if should_disable_native_window_decorations(std::env::consts::OS) {
if let Some(window) = app.get_webview_window("main") {
let _ = window.set_decorations(false);
}