// Copyright (c) 2026 Storm Dragon // Authors: Storm Dragon, Angus Kola // SPDX-License-Identifier: GPL-3.0-or-later package app import ( "git.stormux.org/storm/cthulhu/internal/config" "git.stormux.org/storm/cthulhu/internal/wine" "sync/atomic" ) // Published settings are immutable snapshots shared by the preferences, input, // and accessibility workers. Each event uses one complete snapshot. type liveSettings struct { current atomic.Pointer[config.Settings] application atomic.Pointer[string] requestedApplication atomic.Pointer[string] clipboardChanges chan struct{} onApplication func(string) wineTitles chan wineWindowTitle wineReview *wine.ReviewRegistry } func (live *liveSettings) Store(settings config.Settings) { live.current.Store(&settings) live.notify_clipboard() } func (live *liveSettings) notify_clipboard() { select { case live.clipboardChanges <- struct{}{}: default: } } func (live *liveSettings) Load() config.Settings { return *live.current.Load() }