mirror of
https://github.com/nekename/OpenDeck.git
synced 2026-10-28 09:44:01 +00:00
Co-authored-by: nekename <63245705+nekename@users.noreply.github.com>
31 lines
917 B
TypeScript
31 lines
917 B
TypeScript
export type Settings = {
|
|
version: string;
|
|
language: string;
|
|
brightness: number;
|
|
sleep_timeout_minutes: number;
|
|
sleep_when_computer_locked: boolean;
|
|
rotation: number;
|
|
background: boolean;
|
|
autolaunch: boolean;
|
|
updatecheck: boolean;
|
|
statistics: boolean;
|
|
separatewine: boolean;
|
|
developer: boolean;
|
|
disableelgato: boolean;
|
|
};
|
|
|
|
import { invoke } from "@tauri-apps/api/core";
|
|
import { type Writable, writable } from "svelte/store";
|
|
import { locale } from "./i18n.ts";
|
|
|
|
export const settings: Writable<Settings | null> = writable(null);
|
|
(async () => settings.set(await invoke("get_settings")))();
|
|
export const localisations: Writable<{ [plugin: string]: any } | null> = writable(null);
|
|
settings.subscribe(async (value) => {
|
|
if (value) {
|
|
await invoke("set_settings", { settings: value });
|
|
locale.set(value.language);
|
|
localisations.set(await invoke("get_localisations", { locale: value.language }));
|
|
}
|
|
});
|