diff --git a/apps/desktop/src-tauri/src/general_settings.rs b/apps/desktop/src-tauri/src/general_settings.rs index 47de3574..09fe123d 100644 --- a/apps/desktop/src-tauri/src/general_settings.rs +++ b/apps/desktop/src-tauri/src/general_settings.rs @@ -23,6 +23,8 @@ pub struct GeneralSettingsStore { // first launch: store won't exist so show startup #[serde(default = "true_b")] pub has_completed_startup: bool, + #[serde(default)] + pub dark_mode: bool, } fn true_b() -> bool { diff --git a/apps/desktop/src/App.tsx b/apps/desktop/src/App.tsx index cbdb5987..54bee247 100644 --- a/apps/desktop/src/App.tsx +++ b/apps/desktop/src/App.tsx @@ -7,7 +7,9 @@ import { message } from "@tauri-apps/plugin-dialog"; import "@cap/ui-solid/main.css"; import "unfonts.css"; +import "./styles/theme.css"; import { commands } from "./utils/tauri"; +import { themeStore } from "./store/theme"; const queryClient = new QueryClient({ defaultOptions: { @@ -20,37 +22,55 @@ const queryClient = new QueryClient({ }); export default function App() { + const darkMode = themeStore.isDarkMode; + + onMount(async () => { + await themeStore.initialize(); + + const matches = useCurrentMatches(); + + onMount(() => { + for (const match of matches()) { + if (match.route.info?.AUTO_SHOW_WINDOW === false) return; + } + + getCurrentWindow().show(); + }); + }); + return ( - { - console.error(e); - return ( - <> -

{e.toString()}

-

{e.stack?.toString()}

- - ); - }} - > - - { - const matches = useCurrentMatches(); - - onMount(() => { - for (const match of matches()) { - if (match.route.info?.AUTO_SHOW_WINDOW === false) return; - } - - getCurrentWindow().show(); - }); - - return {props.children}; - }} - > - - - -
+
+ { + console.error(e); + return ( + <> +

{e.toString()}

+

{e.stack?.toString()}

+ + ); + }} + > + + { + const matches = useCurrentMatches(); + + onMount(() => { + for (const match of matches()) { + if (match.route.info?.AUTO_SHOW_WINDOW === false) return; + } + + getCurrentWindow().show(); + }); + + return {props.children}; + }} + > + + + +
+
); } diff --git a/apps/desktop/src/routes/(window-chrome)/(main).tsx b/apps/desktop/src/routes/(window-chrome)/(main).tsx index 3cf4f29c..4e9576e2 100644 --- a/apps/desktop/src/routes/(window-chrome)/(main).tsx +++ b/apps/desktop/src/routes/(window-chrome)/(main).tsx @@ -118,10 +118,11 @@ export default function () { }); return ( -
+
- +