mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-21 23:05:46 +00:00
13 lines
480 B
TypeScript
13 lines
480 B
TypeScript
import { useEffect } from 'react';
|
|
import { toggleTrayIcon } from '@/lib/api/tray';
|
|
import { useAuthStore } from '@/store/authStore';
|
|
|
|
/** Sync tray-icon visibility with the user's stored setting. Runs once on mount
|
|
* (initial sync) and again whenever the setting changes. */
|
|
export function useTrayIconSync() {
|
|
const showTrayIcon = useAuthStore(s => s.showTrayIcon);
|
|
useEffect(() => {
|
|
toggleTrayIcon({ show: showTrayIcon }).catch(console.error);
|
|
}, [showTrayIcon]);
|
|
}
|