mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-24 01:38:26 +02:00
Make settings menu a regular window (#113)
This commit is contained in:
15
src-web/font-size.ts
Normal file
15
src-web/font-size.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
// Listen for settings changes, the re-compute theme
|
||||
import { listen } from '@tauri-apps/api/event';
|
||||
import type { ModelPayload } from './components/GlobalHooks';
|
||||
import { getSettings } from './lib/store';
|
||||
|
||||
function setFontSizeOnDocument(fontSize: number) {
|
||||
document.documentElement.style.fontSize = `${fontSize}px`;
|
||||
}
|
||||
|
||||
listen<ModelPayload>('upserted_model', async (event) => {
|
||||
if (event.payload.model.model !== 'settings') return;
|
||||
setFontSizeOnDocument(event.payload.model.interfaceFontSize);
|
||||
}).catch(console.error);
|
||||
|
||||
getSettings().then((settings) => setFontSizeOnDocument(settings.interfaceFontSize));
|
||||
Reference in New Issue
Block a user