feat(settings): add notifications toggle

Users can now disable toast notifications (buffering, track changes, etc.)
from Settings > Appearance. Error notifications are always shown.

cc
This commit is contained in:
vicrodh committed 2026-01-14 04:41:13 -06:00
1 parent 7e37b8d6c8
commit 3a7b05b859
5 files changed
+54 -4

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "qbz-nix",
"version": "1.1.3",
"version": "1.1.4",
"description": "Native Qobuz client for Linux with Hi-Fi audio support",
"type": "module",
"scripts": {
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "qbz-nix"
version = "1.1.3"
version = "1.1.4"
description = "Native Qobuz client for Linux with Hi-Fi audio support"
authors = ["blitzkriegfc"]
edition = "2021"
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "QBZ",
"version": "1.1.3",
"version": "1.1.4",
"identifier": "com.blitzkriegfc.qbz",
"build": {
"beforeDevCommand": "npm run dev",
+15 -1
View File
@@ -16,6 +16,11 @@
} from '$lib/stores/downloadState';
import { clearCache as clearLyricsCache } from '$lib/stores/lyricsStore';
import { getDevicePrettyName } from '$lib/utils/audioDeviceNames';
import {
getNotificationsEnabled,
setNotificationsEnabled,
loadNotificationsPreference
} from '$lib/stores/toastStore';
interface Props {
onBack?: () => void;
@@ -138,6 +143,7 @@
// Appearance settings
let theme = $state('Dark');
let compactMode = $state(false);
let notificationsEnabled = $state(true);
let language = $state('Auto');
// Last.fm integration state
@@ -209,6 +215,10 @@
// Load API keys state
loadApiKeysState();
// Load notifications preference
loadNotificationsPreference();
notificationsEnabled = getNotificationsEnabled();
});
async function loadLastfmState() {
@@ -840,10 +850,14 @@
onchange={handleZoomChange}
/>
</div>
<div class="setting-row last">
<div class="setting-row">
<span class="setting-label">Compact Mode</span>
<Toggle enabled={compactMode} onchange={(v) => (compactMode = v)} />
</div>
<div class="setting-row last">
<span class="setting-label">Notifications</span>
<Toggle enabled={notificationsEnabled} onchange={(v) => { notificationsEnabled = v; setNotificationsEnabled(v); }} />
</div>
</section>
<!-- Integrations Section -->
+36
View File
@@ -18,6 +18,37 @@ let currentToast: Toast | null = null;
// Track buffering toast specifically so we can dismiss it
let bufferingToastActive = false;
// Global enable/disable for notifications
let notificationsEnabled = true;
/**
* Load notifications preference from localStorage
*/
export function loadNotificationsPreference(): void {
const saved = localStorage.getItem('qbz-notifications-enabled');
if (saved !== null) {
notificationsEnabled = saved === 'true';
}
}
/**
* Set notifications enabled/disabled
*/
export function setNotificationsEnabled(enabled: boolean): void {
notificationsEnabled = enabled;
localStorage.setItem('qbz-notifications-enabled', String(enabled));
if (!enabled) {
hideToast();
}
}
/**
* Get notifications enabled state
*/
export function getNotificationsEnabled(): boolean {
return notificationsEnabled;
}
// Auto-hide timeout
let hideTimeout: ReturnType<typeof setTimeout> | null = null;
@@ -45,6 +76,11 @@ export function isBufferingActive(): boolean {
* @param duration How long to show the toast in ms (default: varies by type)
*/
export function showToast(message: string, type: ToastType = 'info', duration?: number): void {
// Skip if notifications are disabled (except errors which are always shown)
if (!notificationsEnabled && type !== 'error') {
return;
}
// Clear existing timeout
if (hideTimeout) {
clearTimeout(hideTimeout);