T-032: Tray-Icon (Anzeigen/Beenden), Autostart-Plugin, Einstellungs-Panel (Zahnrad in der Leiste)
This commit is contained in:
@ -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}
|
||||
|
||||
@ -437,3 +437,9 @@ code {
|
||||
font-size: 0.85rem;
|
||||
padding: 0.25rem 0.5rem;
|
||||
}
|
||||
|
||||
.settings .setrow {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
'<path d="m4 6 6 6-6 6"/><path d="m13 6 6 6-6 6"/>',
|
||||
check: '<path d="M4 12l5 5L20 6"/>',
|
||||
flag: '<path d="M6 21V4h11l-2.5 4L17 12H6"/>',
|
||||
gear:
|
||||
'<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/>',
|
||||
pencil:
|
||||
'<path d="M4 20h4L20 8l-4-4L4 16v4z"/><path d="M13.5 6.5l4 4"/>',
|
||||
x: '<path d="M5 5l14 14"/><path d="M19 5 5 19"/>',
|
||||
|
||||
@ -76,6 +76,8 @@ export const bmRemove = (asin: string, index: number) =>
|
||||
invoke<Bm[]>('bookmark_remove', { asin, index })
|
||||
export const bmSetNote = (asin: string, index: number, note: string) =>
|
||||
invoke<Bm[]>('bookmark_set_note', { asin, index, note })
|
||||
export const autostartEnabled = () => invoke<boolean>('autostart_enabled')
|
||||
export const autostartSet = (on: boolean) => invoke<void>('autostart_set', { on })
|
||||
export function fmtClock(sec: number): string {
|
||||
const t = Math.max(0, Math.floor(sec))
|
||||
const h = Math.floor(t / 3600)
|
||||
|
||||
Reference in New Issue
Block a user