T-032: Tray-Icon (Anzeigen/Beenden), Autostart-Plugin, Einstellungs-Panel (Zahnrad in der Leiste)

This commit is contained in:
2026-11-06 20:38:40 +01:00
parent 06ac4ebd11
commit e7fe398f39
7 changed files with 222 additions and 8 deletions

View File

@ -29,6 +29,8 @@
bmAdd,
bmRemove,
bmSetNote,
autostartEnabled,
autostartSet,
type Bm,
type Book,
type DlItem,
@ -123,6 +125,23 @@
playerSetPosition(bookmarks[idx]?.time ?? 0)
}
// Einstellungen (T-032)
let settingsOpen = $state(false)
let autostart = $state(false)
function openSettings(): void {
settingsOpen = !settingsOpen
if (settingsOpen) {
autostartEnabled().then((on) => (autostart = on)).catch(() => (autostart = false))
}
}
function setAutostart(on: boolean): void {
autostartSet(on)
.then(() => (autostart = on))
.catch((e) => (error = String(e)))
}
function setSleep(sel: string): void {
if (sleepTimer) {
clearInterval(sleepTimer)
@ -649,6 +668,7 @@
/>
<button class="ghost iconbtn" title="Lesezeichen (Panel)" onclick={() => openBookmarks()}><Icon name="flag" size={14} /></button>
<button class="ghost iconbtn" title="Bookmark an aktueller Stelle" onclick={() => bookmarkAddHere()}><Icon name="pencil" size={14} /></button>
<button class="ghost iconbtn" title="Einstellungen" onclick={() => openSettings()}><Icon name="gear" size={14} /></button>
<button class="ghost" title="Schließen" onclick={() => playerStop()}><Icon name="x" /></button>
<span class="sleepwrap">
<Icon name="moon" size={13} />
@ -696,6 +716,26 @@
<button class="ghost" title="Panel schließen" onclick={() => (bmOpen = false)}><Icon name="x" size={12} /></button>
</div>
{/if}
{#if settingsOpen}
<div class="bmpanel settings">
<label class="setrow">
<input
type="checkbox"
checked={autostart}
onchange={(e) => setAutostart(e.currentTarget.checked)}
/>
<span>Beim Systemstart starten</span>
</label>
<p class="muted small" style="margin:0">
Daten: <code>~/.local/share/hoerwerk/</code> · Downloads:
<code>~/.cache/hoerwerk/</code>
</p>
<p class="muted small" style="margin:0">
Tray-Icon im Systemmenü (Anzeigen/Beenden). Media-Tasten über MPRIS.
</p>
<button class="ghost" title="Schließen" onclick={() => (settingsOpen = false)}><Icon name="x" size={12} /></button>
</div>
{/if}
{/if}
</main>
{/if}