Ports every remaining view (Keybinds, the last one — dual Flat/MultiLayout schema detection, per-action dedicated fields with a raw-JSON fallback for anything not modeled) and removes the now-fully-dead GTK4 crate (root Cargo.toml + src/), leaving src-tauri/ as the single Rust binary crate. Also folds in the UX pass done alongside the migration: responsive multi-column layout instead of a single centered column, chip/dropdown pickers replacing free-typed fields (Wi-Fi networks, Bar style, keyboard layout, tag lists), consistent pill-switch toggles and boxed-list card styling across every page, and a sidebar scroll-chaining fix.
29 lines
950 B
TypeScript
29 lines
950 B
TypeScript
// Bridges bread-theme's pywal-derived palette into the webview. Mirrors
|
|
// bread_theme::gtk::apply_shared()'s two-phase pattern: fetch once at
|
|
// startup, then keep it live via a backend-pushed event — see
|
|
// src-tauri/src/commands/theme.rs for the file-watch side of this.
|
|
|
|
import { invoke } from "@tauri-apps/api/core";
|
|
import { listen } from "@tauri-apps/api/event";
|
|
|
|
const STYLE_ELEMENT_ID = "bread-theme";
|
|
|
|
function applyThemeCss(css: string) {
|
|
let style = document.getElementById(STYLE_ELEMENT_ID);
|
|
if (!style) {
|
|
style = document.createElement("style");
|
|
style.id = STYLE_ELEMENT_ID;
|
|
document.head.appendChild(style);
|
|
}
|
|
style.textContent = css;
|
|
}
|
|
|
|
/** Call once at startup (e.g. from a root `$effect`/`onMount`). */
|
|
export async function initTheme(): Promise<void> {
|
|
const css = await invoke<string>("get_theme_css");
|
|
applyThemeCss(css);
|
|
|
|
await listen<string>("theme-changed", (event) => {
|
|
applyThemeCss(event.payload);
|
|
});
|
|
}
|