Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

refactor: hoist shared dark mode theme out of platform blocks

Tw93e84869624203
diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rs
index 4f8670d4..173f1b8c 100644
--- a/src-tauri/src/app/window.rs
+++ b/src-tauri/src/app/window.rs
@@ -346,6 +346,14 @@ fn build_window(
let mut parsed_proxy_url: Option<Url> = None;
+ // Default to following the system theme (None), only force dark when explicitly set.
+ // Computed once; the matching platform block below is the sole consumer.
+ let theme = if window_config.dark_mode {
+ Some(Theme::Dark)
+ } else {
+ None // Follow system theme
+ };
+
// Platform-specific configuration must be set before proxy on Windows/Linux
#[cfg(target_os = "macos")]
{
@@ -355,24 +363,12 @@ fn build_window(
TitleBarStyle::Visible
};
window_builder = window_builder.title_bar_style(title_bar_style);
-
- // Default to following system theme (None), only force dark when explicitly set
- let theme = if window_config.dark_mode {
- Some(Theme::Dark)
- } else {
- None // Follow system theme
- };
window_builder = window_builder.theme(theme);
}
// Windows and Linux: set data_directory before proxy_url
#[cfg(not(target_os = "macos"))]
{
- let theme = if window_config.dark_mode {
- Some(Theme::Dark)
- } else {
- None // Follow system theme
- };
window_builder = window_builder.data_directory(_data_dir).theme(theme);
if !config.proxy_url.is_empty() {