Title bar in bg on Windows: theme colours on the native caption
ci / build (ubuntu-22.04) (push) Canceled after 0s
ci / build (windows-2025) (push) Canceled after 0s
ci / deny (push) Canceled after 0s

Tauri 2 overlays web content on the title bar only on macOS, so Windows and
Linux keep the native title bar and window controls. On Windows 11 the
caption, title and border now take the theme's bg and text (DWM), re-applied
on every theme change and when the OS setting changes under "System", so the
caption and the app header read as one custom title bar. Linux (GTK) keeps
its own colours.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-20 21:36:31 +09:00
co-authored by Claude Opus 5.5
parent 19c4ce1899
commit c4a677fc3d
5 changed files with 78 additions and 0 deletions
+10
View File
@@ -425,6 +425,15 @@ async fn setup_from_file(app: State<'_, App>, request: tauri::ipc::Request<'_>)
app.sync.setup_from_file(bytes)
}
/// The theme's `bg` and `text` for the native title bar (Windows 11 only; see `title_bar`).
#[tauri::command]
fn set_title_bar_colors(window: tauri::WebviewWindow, bg: String, text: String) {
#[cfg(windows)]
kestrove_desktop::title_bar::paint(&window, &bg, &text);
#[cfg(not(windows))]
let _ = (window, bg, text);
}
#[tauri::command]
fn clear_setup(app: State<'_, App>) {
app.sync.clear_setup();
@@ -616,6 +625,7 @@ fn main() {
})
.invoke_handler(tauri::generate_handler![
state,
set_title_bar_colors,
create_account,
unlock,
lock,