fix: use singleton for conf writes

This commit is contained in:
2 * r + 2 * t 2026-04-12 03:46:37 +10:00
parent 3d012e86b3
commit 42b9e57eae
11 changed files with 125 additions and 125 deletions

View file

@ -55,42 +55,42 @@ Item {
property real visualiserSpacing: Config.background.visualiser.spacing ?? 1 property real visualiserSpacing: Config.background.visualiser.spacing ?? 1
function saveConfig() { function saveConfig() {
Config.appearance.anim.durations.scale = root.animDurationsScale; GlobalConfig.appearance.anim.durations.scale = root.animDurationsScale;
Config.appearance.font.family.material = root.fontFamilyMaterial; GlobalConfig.appearance.font.family.material = root.fontFamilyMaterial;
Config.appearance.font.family.mono = root.fontFamilyMono; GlobalConfig.appearance.font.family.mono = root.fontFamilyMono;
Config.appearance.font.family.sans = root.fontFamilySans; GlobalConfig.appearance.font.family.sans = root.fontFamilySans;
Config.appearance.font.size.scale = root.fontSizeScale; GlobalConfig.appearance.font.size.scale = root.fontSizeScale;
Config.appearance.padding.scale = root.paddingScale; GlobalConfig.appearance.padding.scale = root.paddingScale;
Config.appearance.rounding.scale = root.roundingScale; GlobalConfig.appearance.rounding.scale = root.roundingScale;
Config.appearance.spacing.scale = root.spacingScale; GlobalConfig.appearance.spacing.scale = root.spacingScale;
Config.appearance.transparency.enabled = root.transparencyEnabled; GlobalConfig.appearance.transparency.enabled = root.transparencyEnabled;
Config.appearance.transparency.base = root.transparencyBase; GlobalConfig.appearance.transparency.base = root.transparencyBase;
Config.appearance.transparency.layers = root.transparencyLayers; GlobalConfig.appearance.transparency.layers = root.transparencyLayers;
Config.background.desktopClock.enabled = root.desktopClockEnabled; GlobalConfig.background.desktopClock.enabled = root.desktopClockEnabled;
Config.background.enabled = root.backgroundEnabled; GlobalConfig.background.enabled = root.backgroundEnabled;
Config.background.desktopClock.scale = root.desktopClockScale; GlobalConfig.background.desktopClock.scale = root.desktopClockScale;
Config.background.desktopClock.position = root.desktopClockPosition; GlobalConfig.background.desktopClock.position = root.desktopClockPosition;
Config.background.desktopClock.shadow.enabled = root.desktopClockShadowEnabled; GlobalConfig.background.desktopClock.shadow.enabled = root.desktopClockShadowEnabled;
Config.background.desktopClock.shadow.opacity = root.desktopClockShadowOpacity; GlobalConfig.background.desktopClock.shadow.opacity = root.desktopClockShadowOpacity;
Config.background.desktopClock.shadow.blur = root.desktopClockShadowBlur; GlobalConfig.background.desktopClock.shadow.blur = root.desktopClockShadowBlur;
Config.background.desktopClock.background.enabled = root.desktopClockBackgroundEnabled; GlobalConfig.background.desktopClock.background.enabled = root.desktopClockBackgroundEnabled;
Config.background.desktopClock.background.opacity = root.desktopClockBackgroundOpacity; GlobalConfig.background.desktopClock.background.opacity = root.desktopClockBackgroundOpacity;
Config.background.desktopClock.background.blur = root.desktopClockBackgroundBlur; GlobalConfig.background.desktopClock.background.blur = root.desktopClockBackgroundBlur;
Config.background.desktopClock.invertColors = root.desktopClockInvertColors; GlobalConfig.background.desktopClock.invertColors = root.desktopClockInvertColors;
Config.background.wallpaperEnabled = root.wallpaperEnabled; GlobalConfig.background.wallpaperEnabled = root.wallpaperEnabled;
Config.background.visualiser.enabled = root.visualiserEnabled; GlobalConfig.background.visualiser.enabled = root.visualiserEnabled;
Config.background.visualiser.autoHide = root.visualiserAutoHide; GlobalConfig.background.visualiser.autoHide = root.visualiserAutoHide;
Config.background.visualiser.rounding = root.visualiserRounding; GlobalConfig.background.visualiser.rounding = root.visualiserRounding;
Config.background.visualiser.spacing = root.visualiserSpacing; GlobalConfig.background.visualiser.spacing = root.visualiserSpacing;
Config.border.rounding = root.borderRounding; GlobalConfig.border.rounding = root.borderRounding;
Config.border.thickness = root.borderThickness; GlobalConfig.border.thickness = root.borderThickness;
} }
anchors.fill: parent anchors.fill: parent

View file

@ -41,21 +41,21 @@ Item {
property bool showNetwork: Config.dashboard.performance.showNetwork ?? true property bool showNetwork: Config.dashboard.performance.showNetwork ?? true
function saveConfig() { function saveConfig() {
Config.dashboard.enabled = root.enabled; GlobalConfig.dashboard.enabled = root.enabled;
Config.dashboard.showOnHover = root.showOnHover; GlobalConfig.dashboard.showOnHover = root.showOnHover;
Config.dashboard.mediaUpdateInterval = root.mediaUpdateInterval; GlobalConfig.dashboard.mediaUpdateInterval = root.mediaUpdateInterval;
Config.dashboard.resourceUpdateInterval = root.resourceUpdateInterval; GlobalConfig.dashboard.resourceUpdateInterval = root.resourceUpdateInterval;
Config.dashboard.dragThreshold = root.dragThreshold; GlobalConfig.dashboard.dragThreshold = root.dragThreshold;
Config.dashboard.showDashboard = root.showDashboard; GlobalConfig.dashboard.showDashboard = root.showDashboard;
Config.dashboard.showMedia = root.showMedia; GlobalConfig.dashboard.showMedia = root.showMedia;
Config.dashboard.showPerformance = root.showPerformance; GlobalConfig.dashboard.showPerformance = root.showPerformance;
Config.dashboard.showWeather = root.showWeather; GlobalConfig.dashboard.showWeather = root.showWeather;
Config.dashboard.performance.showBattery = root.showBattery; GlobalConfig.dashboard.performance.showBattery = root.showBattery;
Config.dashboard.performance.showGpu = root.showGpu; GlobalConfig.dashboard.performance.showGpu = root.showGpu;
Config.dashboard.performance.showCpu = root.showCpu; GlobalConfig.dashboard.performance.showCpu = root.showCpu;
Config.dashboard.performance.showMemory = root.showMemory; GlobalConfig.dashboard.performance.showMemory = root.showMemory;
Config.dashboard.performance.showStorage = root.showStorage; GlobalConfig.dashboard.performance.showStorage = root.showStorage;
Config.dashboard.performance.showNetwork = root.showNetwork; GlobalConfig.dashboard.performance.showNetwork = root.showNetwork;
// Note: sizes properties are readonly and cannot be modified // Note: sizes properties are readonly and cannot be modified
} }

View file

@ -61,7 +61,7 @@ Item {
} }
} }
Config.launcher.hiddenApps = hiddenApps; GlobalConfig.launcher.hiddenApps = hiddenApps;
} }
function filterApps(search: string): list<var> { function filterApps(search: string): list<var> {
@ -624,7 +624,7 @@ Item {
favouriteApps.splice(index, 1); favouriteApps.splice(index, 1);
} }
} }
Config.launcher.favouriteApps = favouriteApps; GlobalConfig.launcher.favouriteApps = favouriteApps;
} }
} }
} }
@ -656,7 +656,7 @@ Item {
hiddenApps.splice(index, 1); hiddenApps.splice(index, 1);
} }
} }
Config.launcher.hiddenApps = hiddenApps; GlobalConfig.launcher.hiddenApps = hiddenApps;
} }
} }
} }

View file

@ -33,7 +33,7 @@ ColumnLayout {
label: qsTr("Enabled") label: qsTr("Enabled")
checked: Config.launcher.enabled checked: Config.launcher.enabled
toggle.onToggled: { toggle.onToggled: {
Config.launcher.enabled = checked; GlobalConfig.launcher.enabled = checked;
} }
} }
@ -41,7 +41,7 @@ ColumnLayout {
label: qsTr("Show on hover") label: qsTr("Show on hover")
checked: Config.launcher.showOnHover checked: Config.launcher.showOnHover
toggle.onToggled: { toggle.onToggled: {
Config.launcher.showOnHover = checked; GlobalConfig.launcher.showOnHover = checked;
} }
} }
@ -49,7 +49,7 @@ ColumnLayout {
label: qsTr("Vim keybinds") label: qsTr("Vim keybinds")
checked: Config.launcher.vimKeybinds checked: Config.launcher.vimKeybinds
toggle.onToggled: { toggle.onToggled: {
Config.launcher.vimKeybinds = checked; GlobalConfig.launcher.vimKeybinds = checked;
} }
} }
@ -57,7 +57,7 @@ ColumnLayout {
label: qsTr("Enable dangerous actions") label: qsTr("Enable dangerous actions")
checked: Config.launcher.enableDangerousActions checked: Config.launcher.enableDangerousActions
toggle.onToggled: { toggle.onToggled: {
Config.launcher.enableDangerousActions = checked; GlobalConfig.launcher.enableDangerousActions = checked;
} }
} }
} }
@ -121,7 +121,7 @@ ColumnLayout {
label: qsTr("Apps") label: qsTr("Apps")
checked: Config.launcher.useFuzzy.apps checked: Config.launcher.useFuzzy.apps
toggle.onToggled: { toggle.onToggled: {
Config.launcher.useFuzzy.apps = checked; GlobalConfig.launcher.useFuzzy.apps = checked;
} }
} }
@ -129,7 +129,7 @@ ColumnLayout {
label: qsTr("Actions") label: qsTr("Actions")
checked: Config.launcher.useFuzzy.actions checked: Config.launcher.useFuzzy.actions
toggle.onToggled: { toggle.onToggled: {
Config.launcher.useFuzzy.actions = checked; GlobalConfig.launcher.useFuzzy.actions = checked;
} }
} }
@ -137,7 +137,7 @@ ColumnLayout {
label: qsTr("Schemes") label: qsTr("Schemes")
checked: Config.launcher.useFuzzy.schemes checked: Config.launcher.useFuzzy.schemes
toggle.onToggled: { toggle.onToggled: {
Config.launcher.useFuzzy.schemes = checked; GlobalConfig.launcher.useFuzzy.schemes = checked;
} }
} }
@ -145,7 +145,7 @@ ColumnLayout {
label: qsTr("Variants") label: qsTr("Variants")
checked: Config.launcher.useFuzzy.variants checked: Config.launcher.useFuzzy.variants
toggle.onToggled: { toggle.onToggled: {
Config.launcher.useFuzzy.variants = checked; GlobalConfig.launcher.useFuzzy.variants = checked;
} }
} }
@ -153,7 +153,7 @@ ColumnLayout {
label: qsTr("Wallpapers") label: qsTr("Wallpapers")
checked: Config.launcher.useFuzzy.wallpapers checked: Config.launcher.useFuzzy.wallpapers
toggle.onToggled: { toggle.onToggled: {
Config.launcher.useFuzzy.wallpapers = checked; GlobalConfig.launcher.useFuzzy.wallpapers = checked;
} }
} }
} }

View file

@ -75,7 +75,7 @@ ColumnLayout {
label: qsTr("VPN enabled") label: qsTr("VPN enabled")
checked: Config.utilities.vpn.enabled checked: Config.utilities.vpn.enabled
toggle.onToggled: { toggle.onToggled: {
Config.utilities.vpn.enabled = checked; GlobalConfig.utilities.vpn.enabled = checked;
} }
} }

View file

@ -85,7 +85,7 @@ DeviceDetails {
} }
} }
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
} }
} }
@ -139,7 +139,7 @@ DeviceDetails {
providers.push(Config.utilities.vpn.provider[i]); providers.push(Config.utilities.vpn.provider[i]);
} }
} }
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
root.session.vpn.active = null; root.session.vpn.active = null;
} }
} }
@ -537,7 +537,7 @@ DeviceDetails {
} }
} }
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
editVpnDialog.closeWithAnimation(); editVpnDialog.closeWithAnimation();
} }
} }

View file

@ -47,7 +47,7 @@ ColumnLayout {
providers.push(p); providers.push(p);
} }
} }
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
Qt.callLater(function () { Qt.callLater(function () {
VPN.toggle(); VPN.toggle();
@ -242,7 +242,7 @@ ColumnLayout {
providers.push(p); providers.push(p);
} }
} }
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
Qt.callLater(function () { Qt.callLater(function () {
VPN.toggle(); VPN.toggle();
@ -291,7 +291,7 @@ ColumnLayout {
providers.push(reconstructed); providers.push(reconstructed);
} }
} }
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
} }
} }
@ -492,7 +492,7 @@ ColumnLayout {
displayName: "NetBird", displayName: "NetBird",
interface: "wt0" interface: "wt0"
}); });
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
vpnDialog.closeWithAnimation(); vpnDialog.closeWithAnimation();
} }
} }
@ -512,7 +512,7 @@ ColumnLayout {
displayName: "Tailscale", displayName: "Tailscale",
interface: "tailscale0" interface: "tailscale0"
}); });
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
vpnDialog.closeWithAnimation(); vpnDialog.closeWithAnimation();
} }
} }
@ -532,7 +532,7 @@ ColumnLayout {
displayName: "Cloudflare WARP", displayName: "Cloudflare WARP",
interface: "CloudflareWARP" interface: "CloudflareWARP"
}); });
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
vpnDialog.closeWithAnimation(); vpnDialog.closeWithAnimation();
} }
} }
@ -799,7 +799,7 @@ ColumnLayout {
providers.push(newProvider); providers.push(newProvider);
} }
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
vpnDialog.closeWithAnimation(); vpnDialog.closeWithAnimation();
} }
} }

View file

@ -36,7 +36,7 @@ ColumnLayout {
label: qsTr("VPN enabled") label: qsTr("VPN enabled")
checked: Config.utilities.vpn.enabled checked: Config.utilities.vpn.enabled
toggle.onToggled: { toggle.onToggled: {
Config.utilities.vpn.enabled = checked; GlobalConfig.utilities.vpn.enabled = checked;
} }
} }
} }
@ -147,7 +147,7 @@ ColumnLayout {
providers.unshift(provider); providers.unshift(provider);
} }
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
} }
} }
@ -173,7 +173,7 @@ ColumnLayout {
providers.push(reconstructed); providers.push(reconstructed);
} }
} }
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
} }
} }
} }
@ -216,7 +216,7 @@ ColumnLayout {
displayName: "NetBird", displayName: "NetBird",
interface: "wt0" interface: "wt0"
}); });
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
} }
} }
@ -233,7 +233,7 @@ ColumnLayout {
displayName: "Tailscale", displayName: "Tailscale",
interface: "tailscale0" interface: "tailscale0"
}); });
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
} }
} }
@ -250,7 +250,7 @@ ColumnLayout {
displayName: "Cloudflare WARP", displayName: "Cloudflare WARP",
interface: "CloudflareWARP" interface: "CloudflareWARP"
}); });
Config.utilities.vpn.provider = providers; GlobalConfig.utilities.vpn.provider = providers;
} }
} }
} }

View file

@ -38,24 +38,24 @@ Item {
property bool nowPlaying: Config.utilities.toasts.nowPlaying ?? false property bool nowPlaying: Config.utilities.toasts.nowPlaying ?? false
function saveConfig(): void { function saveConfig(): void {
Config.notifs.expire = root.notificationsExpire; GlobalConfig.notifs.expire = root.notificationsExpire;
Config.notifs.fullscreen = root.notificationsFullscreen; GlobalConfig.notifs.fullscreen = root.notificationsFullscreen;
Config.notifs.openExpanded = root.notificationsOpenExpanded; GlobalConfig.notifs.openExpanded = root.notificationsOpenExpanded;
Config.notifs.defaultExpireTimeout = root.notificationsDefaultExpireTimeout; GlobalConfig.notifs.defaultExpireTimeout = root.notificationsDefaultExpireTimeout;
Config.notifs.groupPreviewNum = root.notificationsGroupPreviewNum; GlobalConfig.notifs.groupPreviewNum = root.notificationsGroupPreviewNum;
Config.utilities.maxToasts = root.maxToasts; GlobalConfig.utilities.maxToasts = root.maxToasts;
Config.utilities.toasts.fullscreen = root.toastsFullscreen; GlobalConfig.utilities.toasts.fullscreen = root.toastsFullscreen;
Config.utilities.toasts.chargingChanged = root.chargingChanged; GlobalConfig.utilities.toasts.chargingChanged = root.chargingChanged;
Config.utilities.toasts.gameModeChanged = root.gameModeChanged; GlobalConfig.utilities.toasts.gameModeChanged = root.gameModeChanged;
Config.utilities.toasts.dndChanged = root.dndChanged; GlobalConfig.utilities.toasts.dndChanged = root.dndChanged;
Config.utilities.toasts.audioOutputChanged = root.audioOutputChanged; GlobalConfig.utilities.toasts.audioOutputChanged = root.audioOutputChanged;
Config.utilities.toasts.audioInputChanged = root.audioInputChanged; GlobalConfig.utilities.toasts.audioInputChanged = root.audioInputChanged;
Config.utilities.toasts.capsLockChanged = root.capsLockChanged; GlobalConfig.utilities.toasts.capsLockChanged = root.capsLockChanged;
Config.utilities.toasts.numLockChanged = root.numLockChanged; GlobalConfig.utilities.toasts.numLockChanged = root.numLockChanged;
Config.utilities.toasts.kbLayoutChanged = root.kbLayoutChanged; GlobalConfig.utilities.toasts.kbLayoutChanged = root.kbLayoutChanged;
Config.utilities.toasts.vpnChanged = root.vpnChanged; GlobalConfig.utilities.toasts.vpnChanged = root.vpnChanged;
Config.utilities.toasts.nowPlaying = root.nowPlaying; GlobalConfig.utilities.toasts.nowPlaying = root.nowPlaying;
} }
anchors.fill: parent anchors.fill: parent

View file

@ -54,38 +54,38 @@ Item {
property list<string> excludedScreens: Config.bar.excludedScreens ?? [] property list<string> excludedScreens: Config.bar.excludedScreens ?? []
function saveConfig(entryIndex, entryEnabled) { function saveConfig(entryIndex, entryEnabled) {
Config.bar.activeWindow.compact = root.activeWindowCompact; GlobalConfig.bar.activeWindow.compact = root.activeWindowCompact;
Config.bar.activeWindow.inverted = root.activeWindowInverted; GlobalConfig.bar.activeWindow.inverted = root.activeWindowInverted;
Config.bar.clock.background = root.clockBackground; GlobalConfig.bar.clock.background = root.clockBackground;
Config.bar.clock.showDate = root.clockShowDate; GlobalConfig.bar.clock.showDate = root.clockShowDate;
Config.bar.clock.showIcon = root.clockShowIcon; GlobalConfig.bar.clock.showIcon = root.clockShowIcon;
Config.bar.persistent = root.persistent; GlobalConfig.bar.persistent = root.persistent;
Config.bar.showOnHover = root.showOnHover; GlobalConfig.bar.showOnHover = root.showOnHover;
Config.bar.dragThreshold = root.dragThreshold; GlobalConfig.bar.dragThreshold = root.dragThreshold;
Config.bar.status.showAudio = root.showAudio; GlobalConfig.bar.status.showAudio = root.showAudio;
Config.bar.status.showMicrophone = root.showMicrophone; GlobalConfig.bar.status.showMicrophone = root.showMicrophone;
Config.bar.status.showKbLayout = root.showKbLayout; GlobalConfig.bar.status.showKbLayout = root.showKbLayout;
Config.bar.status.showNetwork = root.showNetwork; GlobalConfig.bar.status.showNetwork = root.showNetwork;
Config.bar.status.showWifi = root.showWifi; GlobalConfig.bar.status.showWifi = root.showWifi;
Config.bar.status.showBluetooth = root.showBluetooth; GlobalConfig.bar.status.showBluetooth = root.showBluetooth;
Config.bar.status.showBattery = root.showBattery; GlobalConfig.bar.status.showBattery = root.showBattery;
Config.bar.status.showLockStatus = root.showLockStatus; GlobalConfig.bar.status.showLockStatus = root.showLockStatus;
Config.bar.tray.background = root.trayBackground; GlobalConfig.bar.tray.background = root.trayBackground;
Config.bar.tray.compact = root.trayCompact; GlobalConfig.bar.tray.compact = root.trayCompact;
Config.bar.tray.recolour = root.trayRecolour; GlobalConfig.bar.tray.recolour = root.trayRecolour;
Config.bar.workspaces.shown = root.workspacesShown; GlobalConfig.bar.workspaces.shown = root.workspacesShown;
Config.bar.workspaces.activeIndicator = root.workspacesActiveIndicator; GlobalConfig.bar.workspaces.activeIndicator = root.workspacesActiveIndicator;
Config.bar.workspaces.occupiedBg = root.workspacesOccupiedBg; GlobalConfig.bar.workspaces.occupiedBg = root.workspacesOccupiedBg;
Config.bar.workspaces.showWindows = root.workspacesShowWindows; GlobalConfig.bar.workspaces.showWindows = root.workspacesShowWindows;
Config.bar.workspaces.maxWindowIcons = root.workspacesMaxWindowIcons; GlobalConfig.bar.workspaces.maxWindowIcons = root.workspacesMaxWindowIcons;
Config.bar.workspaces.perMonitorWorkspaces = root.workspacesPerMonitor; GlobalConfig.bar.workspaces.perMonitorWorkspaces = root.workspacesPerMonitor;
Config.bar.scrollActions.workspaces = root.scrollWorkspaces; GlobalConfig.bar.scrollActions.workspaces = root.scrollWorkspaces;
Config.bar.scrollActions.volume = root.scrollVolume; GlobalConfig.bar.scrollActions.volume = root.scrollVolume;
Config.bar.scrollActions.brightness = root.scrollBrightness; GlobalConfig.bar.scrollActions.brightness = root.scrollBrightness;
Config.bar.popouts.activeWindow = root.popoutActiveWindow; GlobalConfig.bar.popouts.activeWindow = root.popoutActiveWindow;
Config.bar.popouts.tray = root.popoutTray; GlobalConfig.bar.popouts.tray = root.popoutTray;
Config.bar.popouts.statusIcons = root.popoutStatusIcons; GlobalConfig.bar.popouts.statusIcons = root.popoutStatusIcons;
Config.bar.excludedScreens = root.excludedScreens; GlobalConfig.bar.excludedScreens = root.excludedScreens;
const entries = []; const entries = [];
for (let i = 0; i < entriesModel.count; i++) { for (let i = 0; i < entriesModel.count; i++) {
@ -99,7 +99,7 @@ Item {
enabled: enabled enabled: enabled
}); });
} }
Config.bar.entries = entries; GlobalConfig.bar.entries = entries;
} }
anchors.fill: parent anchors.fill: parent

View file

@ -68,7 +68,7 @@ Singleton {
} }
function toggleVisibility() { function toggleVisibility() {
Config.services.showLyrics = !Config.services.showLyrics; GlobalConfig.services.showLyrics = !Config.services.showLyrics;
} }
function loadLyrics() { function loadLyrics() {
@ -272,7 +272,7 @@ Singleton {
onPreferredBackendChanged: { onPreferredBackendChanged: {
if (Config.services.lyricsBackend !== preferredBackend) { if (Config.services.lyricsBackend !== preferredBackend) {
Config.services.lyricsBackend = preferredBackend; GlobalConfig.services.lyricsBackend = preferredBackend;
} }
} }