From c45b6c01799447e185e49798fac6ac435a22cf00 Mon Sep 17 00:00:00 2001 From: H-Chris233 Date: Mon, 1 Jun 2026 09:35:07 +0800 Subject: [PATCH] fix(linux): fallback from backdrop-filter when WEBKIT_DISABLE_COMPOSITING_MODE=1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue #553: Linux 上 WEBKIT_DISABLE_COMPOSITING_MODE=1 时 WebKitGTK backdrop-filter 在 DOM 重排后失效(hover 历史词汇表 / 选择条目刷新面板)。 方案: - Rust 端新增 is_no_compositing_mode command 暴露环境变量状态 - App.tsx 初始化时调用,写入 data-ol-no-compositing 到 - CSS 用 [data-ol-no-compositing] 选择器覆盖 inline style,切换到 渐变+噪点纹理假磨砂方案(复用 tokens.css --ol-frost-grain) - WindowChrome/FloatingShell 加 className 钩子 受影响的三处 backdrop-filter:WindowChrome 底板、主面板、 Linux 标题栏。ProviderPrompt/HotkeyModePrompt 弹窗遮罩 (瞬态 UI)跳过。提交签署:Reasonix Code --- openless-all/app/src-tauri/src/commands.rs | 6 +++ openless-all/app/src-tauri/src/lib.rs | 1 + openless-all/app/src/App.tsx | 13 +++++ .../app/src/components/FloatingShell.tsx | 1 + .../app/src/components/WindowChrome.tsx | 5 ++ openless-all/app/src/styles/global.css | 50 +++++++++++++++++++ 6 files changed, 76 insertions(+) diff --git a/openless-all/app/src-tauri/src/commands.rs b/openless-all/app/src-tauri/src/commands.rs index da2df0b2..a31cbb1d 100644 --- a/openless-all/app/src-tauri/src/commands.rs +++ b/openless-all/app/src-tauri/src/commands.rs @@ -3523,6 +3523,12 @@ pub async fn github_device_flow_poll( Ok(GithubDevicePollResult::Error { message: msg }) } +#[tauri::command] +pub fn is_no_compositing_mode() -> bool { + // Linux WebKitGTK: WEBKIT_DISABLE_COMPOSITING_MODE=1 时 backdrop-filter 不可用 + std::env::var("WEBKIT_DISABLE_COMPOSITING_MODE").as_deref() == Ok("1") +} + #[cfg(test)] mod tests { use super::{ diff --git a/openless-all/app/src-tauri/src/lib.rs b/openless-all/app/src-tauri/src/lib.rs index 8b808a61..719a2e31 100644 --- a/openless-all/app/src-tauri/src/lib.rs +++ b/openless-all/app/src-tauri/src/lib.rs @@ -465,6 +465,7 @@ pub fn run() { #[cfg(target_os = "windows")] commands::sherpa_onnx_asr_reveal_model_dir, commands::export_error_log, + commands::is_no_compositing_mode, restart_app, ]) .build(tauri::generate_context!()) diff --git a/openless-all/app/src/App.tsx b/openless-all/app/src/App.tsx index c2b5402b..c3eb54f5 100644 --- a/openless-all/app/src/App.tsx +++ b/openless-all/app/src/App.tsx @@ -17,6 +17,7 @@ import { windowMouseHotkeyCode, } from './lib/windowHotkeyFallback'; import { QaPanel } from './pages/QaPanel'; +import { invoke } from '@tauri-apps/api/core'; import { HotkeySettingsProvider } from './state/HotkeySettingsContext'; interface AppProps { @@ -169,6 +170,18 @@ export function App({ isCapsule, isQa, forcedOs }: AppProps) { }; }, [os]); + // Linux: 检测 WEBKIT_DISABLE_COMPOSITING_MODE → 禁用 backdrop-filter fallback + useEffect(() => { + if (!isTauri) return; + invoke('is_no_compositing_mode').then((val) => { + if (val) { + document.documentElement.dataset.olNoCompositing = 'true'; + } + }).catch((err) => { + console.warn('[startup] is_no_compositing_mode failed', err); + }); + }, []); + if (gate === 'checking') { return ; } diff --git a/openless-all/app/src/components/FloatingShell.tsx b/openless-all/app/src/components/FloatingShell.tsx index 532b91c0..96a99d09 100644 --- a/openless-all/app/src/components/FloatingShell.tsx +++ b/openless-all/app/src/components/FloatingShell.tsx @@ -324,6 +324,7 @@ function FloatingShellBody({ os, initialTab, initialSettings }: { os: OS; initia 一起坐在 WindowChrome 的磨砂底板上,整体一块连续玻璃。 */}