804caa5130
- useTauriDnd + manualDndAtom: the native tray "Do Not Disturb" toggle (lotus-dnd-changed event) OR's into the notification quiet-gate in ClientNonUIFeatures (both invite + message notifiers), alongside Focus Assist. - AutostartSetting in Settings → General (desktop-only): reads/sets plugin:autostart via invoke. Mirrors the window-chrome setting. - Docs: LOTUS_FEATURES desktop section (Linux parity + DND + autostart), LOTUS_TODO P6-1 → [~], LOTUS_BUGS verification row. Gates: tsc/eslint/prettier clean, build OK, 661 tests. Native side committed on cinny-desktop:main (CI-compile-pending). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
22 lines
842 B
TypeScript
22 lines
842 B
TypeScript
import { useSetAtom } from 'jotai';
|
|
import { manualDndAtom } from '../state/manualDnd';
|
|
import { useTauriEvent } from './useTauri';
|
|
|
|
/** Detail shape of the `lotus-dnd-changed` event emitted by the native side. */
|
|
type DndChangedDetail = {
|
|
active: boolean;
|
|
};
|
|
|
|
/**
|
|
* P6-1 — Tray "Do Not Disturb" → notification suppression (desktop). Subscribes
|
|
* to the native `lotus-dnd-changed` event (emitted when the user toggles the
|
|
* tray "Do Not Disturb" item, `{ active }`) and mirrors it into `manualDndAtom`,
|
|
* which the notification gate reads to suppress notifications while DND is on.
|
|
* Inert in the browser, since `useTauriEvent` only listens under Tauri.
|
|
*/
|
|
export function useTauriDnd(): void {
|
|
const setDnd = useSetAtom(manualDndAtom);
|
|
|
|
useTauriEvent<DndChangedDetail>('lotus-dnd-changed', ({ active }) => setDnd(active));
|
|
}
|