feat(settings): add quick-settings row for theme, font size, and hotkey

This commit is contained in:
2026-05-07 10:52:51 +01:00
parent 5778696140
commit 9ba7babcb0

View File

@@ -447,6 +447,43 @@
if (!searchActive) return false; if (!searchActive) return false;
return terms.some((t) => (t || "").toString().toLowerCase().includes(searchQuery)); return terms.some((t) => (t || "").toString().toLowerCase().includes(searchQuery));
} }
// Quick-settings row at the top of SettingsPage. Surfaces theme, font
// size, and the global hotkey above the seven progressive-disclosure
// groups so the most-tweaked controls don't require opening a group.
// Font-size buckets map onto the existing settings.fontSize range
// (10-24); Smaller/Default/Larger map onto 12/14/18 to match the
// existing default of 14. SegmentedButton uses bind:value, so a
// local mirror state syncs with settings.fontSize via $effect — this
// also keeps the row in sync if Appearance's fine-grained slider is
// dragged.
const FONT_SIZE_BUCKETS = { Smaller: 12, Default: 14, Larger: 18 };
function bucketFromSize(fs) {
if ((fs ?? 14) <= 12) return "Smaller";
if ((fs ?? 14) >= 18) return "Larger";
return "Default";
}
let fontSizeBucket = $state(bucketFromSize(settings.fontSize));
$effect(() => {
const next = bucketFromSize(settings.fontSize);
if (next !== fontSizeBucket) fontSizeBucket = next;
});
$effect(() => {
const target = FONT_SIZE_BUCKETS[fontSizeBucket];
if (target !== undefined && settings.fontSize !== target) {
settings.fontSize = target;
}
});
// Hotkey chip jumps to the Global hotkey SettingsGroup. The group
// sits inside Appearance & System; both must be opened so the
// recorder is visible after the scroll lands.
function jumpToGlobalHotkey() {
const wrapper = document.getElementById("global-hotkey-group");
if (!wrapper) return;
const details = wrapper.querySelectorAll("details");
details.forEach((d) => { (d as HTMLDetailsElement).open = true; });
wrapper.scrollIntoView({ behavior: "smooth", block: "start" });
}
let settingsTextFont = $derived(pretextFontShorthand(prefs.accessibility, 11)); let settingsTextFont = $derived(pretextFontShorthand(prefs.accessibility, 11));
let settingsPathLineHeight = $derived(bodyPretextLineHeight(prefs.accessibility, 11)); let settingsPathLineHeight = $derived(bodyPretextLineHeight(prefs.accessibility, 11));
let outputFolderPreview = $derived.by(() => { let outputFolderPreview = $derived.by(() => {
@@ -1070,6 +1107,34 @@
the group renders its content directly. the group renders its content directly.
--> -->
<!-- Quick-settings row. Always visible (not subject to the
settings search filter). Surfaces theme, font size, and
the global hotkey above the seven groups. -->
<div class="grid grid-cols-3 gap-3 px-1 pb-4 border-b border-border-subtle mb-2">
<div>
<p class="text-[10px] font-medium text-text-tertiary uppercase tracking-wider mb-2">Theme</p>
<SegmentedButton size="small" options={["Dark", "Light"]} bind:value={settings.theme} />
</div>
<div>
<p class="text-[10px] font-medium text-text-tertiary uppercase tracking-wider mb-2">Font size</p>
<SegmentedButton
size="small"
options={["Smaller", "Default", "Larger"]}
bind:value={fontSizeBucket}
/>
</div>
<div>
<p class="text-[10px] font-medium text-text-tertiary uppercase tracking-wider mb-2">Hotkey</p>
<button
type="button"
onclick={jumpToGlobalHotkey}
class="px-2.5 py-1 text-[11px] font-medium rounded-lg bg-bg-elevated text-text-secondary border border-border-subtle hover:border-accent hover:text-accent"
style="transition-duration: var(--duration-ui)"
aria-label={`Edit global hotkey, currently ${settings.globalHotkey}`}
>{settings.globalHotkey}</button>
</div>
</div>
<!-- 1. Audio — input device, gain, monitoring, RMS/VAD --> <!-- 1. Audio — input device, gain, monitoring, RMS/VAD -->
<SettingsGroup <SettingsGroup
title="Audio" title="Audio"
@@ -2269,6 +2334,7 @@
icon={Sliders} icon={Sliders}
open={searchActive ? searchMatches('Appearance System', 'Theme accessibility hotkey About', 'Global hotkey toggle recording shortcut', 'Appearance Theme zone font size locale dark light', 'Accessibility Reduced motion contrast typography lexend opendyslexic atkinson bionic dyslexic', 'About Engine status diagnostic report version') : false} open={searchActive ? searchMatches('Appearance System', 'Theme accessibility hotkey About', 'Global hotkey toggle recording shortcut', 'Appearance Theme zone font size locale dark light', 'Accessibility Reduced motion contrast typography lexend opendyslexic atkinson bionic dyslexic', 'About Engine status diagnostic report version') : false}
> >
<div id="global-hotkey-group">
<SettingsGroup <SettingsGroup
title="Global hotkey" title="Global hotkey"
description="Toggle recording from anywhere." description="Toggle recording from anywhere."
@@ -2279,6 +2345,7 @@
<HotkeyRecorder /> <HotkeyRecorder />
</div> </div>
</SettingsGroup> </SettingsGroup>
</div>
<SettingsGroup <SettingsGroup
title="Appearance" title="Appearance"