From f46255bc42da68821bab2c84a46dec5f955340a2 Mon Sep 17 00:00:00 2001 From: Chintan Patel <216989679+Chintanpatel24@users.noreply.github.com> Date: Sun, 25 Oct 2026 13:57:49 +0530 Subject: [PATCH] fix(settings): dual-persistence, atomic save, and property watcher coverage for sound and shell settings --- crates/agility-cli/src/main.rs | 8 +- crates/agilityd/src/modules/connectivity.rs | 5 +- crates/agilityd/src/modules/theme.rs | 4 +- .../agility/Core/Services/HyprlandService.qml | 12 +++ .../agility/Core/Services/SettingsService.qml | 33 +++++-- .../Core/Services/scripts/read_settings.py | 80 +++++++++++++++ .../Core/Services/scripts/save_settings.py | 97 +++++++++++++++++++ quickshell/agility/Core/Theme.qml | 4 +- .../BarSettings/BarAppletsSettings.qml | 64 +++++++++--- .../Settings/BarSettings/BarSettings.qml | 40 ++++++-- .../EffectsSettings/EffectsSettings.qml | 13 ++- .../IntegrationsSettings.qml | 8 +- .../Settings/scripts/sync_shortcuts.py | 4 +- .../Scripts/system/toggle_kb_layout.sh | 5 +- 14 files changed, 330 insertions(+), 47 deletions(-) create mode 100755 quickshell/agility/Core/Services/scripts/read_settings.py create mode 100755 quickshell/agility/Core/Services/scripts/save_settings.py diff --git a/crates/agility-cli/src/main.rs b/crates/agility-cli/src/main.rs index 66d15a59..d77379d5 100644 --- a/crates/agility-cli/src/main.rs +++ b/crates/agility-cli/src/main.rs @@ -273,7 +273,9 @@ async fn main() -> Result<()> { fn should_bluetooth_power_on_startup() -> bool { let home = std::env::var("HOME").unwrap_or_default(); - let prefs_path = std::path::PathBuf::from(home).join(".cache/quickshell/settings_prefs.json"); + let primary = std::path::PathBuf::from(&home).join(".config/agility-shell/settings_prefs.json"); + let cache = std::path::PathBuf::from(&home).join(".cache/quickshell/settings_prefs.json"); + let prefs_path = if primary.is_file() { primary } else { cache }; if let Ok(data) = std::fs::read_to_string(&prefs_path) { if let Ok(v) = serde_json::from_str::(&data) { return v @@ -1839,7 +1841,9 @@ fn expand_user_path(p: &str) -> std::path::PathBuf { fn get_custom_wallpaper_dir() -> Option { let home = std::env::var("HOME").ok()?; - let prefs_path = Path::new(&home).join(".cache/quickshell/settings_prefs.json"); + let primary = Path::new(&home).join(".config/agility-shell/settings_prefs.json"); + let cache = Path::new(&home).join(".cache/quickshell/settings_prefs.json"); + let prefs_path = if primary.is_file() { primary } else { cache }; let content = fs::read_to_string(&prefs_path).ok()?; let val: serde_json::Value = serde_json::from_str(&content).ok()?; if val.get("wpSourceMode").and_then(|v| v.as_str()) == Some("custom") { diff --git a/crates/agilityd/src/modules/connectivity.rs b/crates/agilityd/src/modules/connectivity.rs index 47de5370..a08f131d 100644 --- a/crates/agilityd/src/modules/connectivity.rs +++ b/crates/agilityd/src/modules/connectivity.rs @@ -99,8 +99,9 @@ impl ConnectivityService { // Enforce Bluetooth off by default on startup unless explicitly enabled in user options let home = std::env::var("HOME").unwrap_or_default(); - let prefs_path = - std::path::PathBuf::from(&home).join(".cache/quickshell/settings_prefs.json"); + let primary = std::path::PathBuf::from(&home).join(".config/agility-shell/settings_prefs.json"); + let cache = std::path::PathBuf::from(&home).join(".cache/quickshell/settings_prefs.json"); + let prefs_path = if primary.is_file() { primary } else { cache }; let bt_startup = if let Ok(data) = std::fs::read_to_string(&prefs_path) { serde_json::from_str::(&data) .ok() diff --git a/crates/agilityd/src/modules/theme.rs b/crates/agilityd/src/modules/theme.rs index 71fe38d7..f23adf43 100644 --- a/crates/agilityd/src/modules/theme.rs +++ b/crates/agilityd/src/modules/theme.rs @@ -41,7 +41,9 @@ pub fn expand_tilde(path_str: &str) -> PathBuf { fn get_custom_wallpaper_dir() -> Option { let home = std::env::var("HOME").ok()?; - let prefs_path = PathBuf::from(&home).join(".cache/quickshell/settings_prefs.json"); + let primary = PathBuf::from(&home).join(".config/agility-shell/settings_prefs.json"); + let cache = PathBuf::from(&home).join(".cache/quickshell/settings_prefs.json"); + let prefs_path = if primary.is_file() { primary } else { cache }; let content = fs::read_to_string(&prefs_path).ok()?; let val: serde_json::Value = serde_json::from_str(&content).ok()?; if val.get("wpSourceMode").and_then(|v| v.as_str()) == Some("custom") { diff --git a/quickshell/agility/Core/Services/HyprlandService.qml b/quickshell/agility/Core/Services/HyprlandService.qml index 7ae62dc5..f4dcda81 100644 --- a/quickshell/agility/Core/Services/HyprlandService.qml +++ b/quickshell/agility/Core/Services/HyprlandService.qml @@ -181,6 +181,18 @@ Item { WallpaperManager.reapplyCurrentWallpaper(); } } + onWpClicksEnabledChanged: { + if (SettingsService.settingsLoaded) + SettingsService.saveSettings(); + } + onWpSourceModeChanged: { + if (SettingsService.settingsLoaded) + SettingsService.saveSettings(); + } + onWpCustomFolderPathChanged: { + if (SettingsService.settingsLoaded) + SettingsService.saveSettings(); + } onKeyboardLayoutChanged: { if (SettingsService.settingsLoaded) { SettingsService.saveSettings(); diff --git a/quickshell/agility/Core/Services/SettingsService.qml b/quickshell/agility/Core/Services/SettingsService.qml index 3d9c9c51..a4a10b79 100644 --- a/quickshell/agility/Core/Services/SettingsService.qml +++ b/quickshell/agility/Core/Services/SettingsService.qml @@ -241,8 +241,23 @@ Item { saveSettings(); } + onBarOpenOnHoverChanged: { if (settingsLoaded) saveSettings(); } onBarGlassModeChanged: { if (settingsLoaded) saveSettings(); } + onBarSolidToneChanged: { if (settingsLoaded) saveSettings(); } onBarGlassOpacityChanged: { if (settingsLoaded) saveSettings(); } + onPillBarThicknessChanged: { if (settingsLoaded) saveSettings(); } + onBluetoothOnStartupChanged: { if (settingsLoaded) saveSettings(); } + onSoundEffectsEnabledChanged: { if (settingsLoaded) saveSettings(); } + onBarIconModeChanged: { if (settingsLoaded) saveSettings(); } + onBarIconShapeChanged: { if (settingsLoaded) saveSettings(); } + onBarIconCycleShapesChanged: { if (settingsLoaded) saveSettings(); } + onBarIconCycleIntervalChanged: { if (settingsLoaded) saveSettings(); } + onBarIconCustomSvgChanged: { if (settingsLoaded) saveSettings(); } + onActionShortcutsChanged: { if (settingsLoaded) saveSettings(); } + onCustomShortcutsChanged: { if (settingsLoaded) saveSettings(); } + onSettingsWindowModeChanged: { if (settingsLoaded) saveSettings(); } + onSettingsBoxedWidthChanged: { if (settingsLoaded) saveSettings(); } + onSettingsBoxedHeightChanged: { if (settingsLoaded) saveSettings(); } onAppletActiveWindowChanged: { if (settingsLoaded) saveSettings(); } onAppletActiveWindowActionChanged: { if (settingsLoaded) saveSettings(); } onAppletDynamicMediaChanged: { if (settingsLoaded) saveSettings(); } @@ -356,10 +371,8 @@ Item { "edgeLightingDirection": settingsService.edgeLightingDirection }; syncShortcuts(); - settingsSaver.command = ["sh", "-c", "mkdir -p ~/.cache/quickshell /var/tmp/sddm-theme && cat << 'EOF' > ~/.cache/quickshell/settings_prefs.json -" + JSON.stringify(data) + " -EOF -cp ~/.cache/quickshell/settings_prefs.json /var/tmp/sddm-theme/settings_prefs.json 2>/dev/null && chmod 666 /var/tmp/sddm-theme/settings_prefs.json 2>/dev/null || true"]; + settingsSaver.command = ["python3", Quickshell.shellDir + "/Core/Services/scripts/save_settings.py", JSON.stringify(data)]; + settingsSaver.running = false; settingsSaver.running = true; } } @@ -367,7 +380,7 @@ cp ~/.cache/quickshell/settings_prefs.json /var/tmp/sddm-theme/settings_prefs.js Process { id: settingsLoader - command: ["cat", Quickshell.env("HOME") + "/.cache/quickshell/settings_prefs.json"] + command: ["python3", Quickshell.shellDir + "/Core/Services/scripts/read_settings.py"] stdout: StdioCollector { id: settingsLoaderOutput } @@ -639,14 +652,16 @@ cp ~/.cache/quickshell/settings_prefs.json /var/tmp/sddm-theme/settings_prefs.js } settingsService.settingsLoaded = true; if (!settingsService.bluetoothOnStartup) { + bluetoothStartupProc.running = false; bluetoothStartupProc.running = true; } HyprlandService.triggerStartupTimer(); } else { + settingsService.settingsLoaded = true; SystemInfoService.applyProfile("balanced"); settingsService.saveSettings(); - settingsService.settingsLoaded = true; if (!settingsService.bluetoothOnStartup) { + bluetoothStartupProc.running = false; bluetoothStartupProc.running = true; } HyprlandService.triggerStartupTimer(); @@ -667,6 +682,12 @@ cp ~/.cache/quickshell/settings_prefs.json /var/tmp/sddm-theme/settings_prefs.js Process { id: settingsSaver + + onExited: function(exitCode) { + if (exitCode !== 0) { + console.error("Agility Shell: settingsSaver exited with code " + exitCode); + } + } } Process { diff --git a/quickshell/agility/Core/Services/scripts/read_settings.py b/quickshell/agility/Core/Services/scripts/read_settings.py new file mode 100755 index 00000000..0d385052 --- /dev/null +++ b/quickshell/agility/Core/Services/scripts/read_settings.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +""" +Settings reader with automatic migration and fallback for Agility Shell. +Checks ~/.config/agility-shell/settings_prefs.json first. +If missing, automatically migrates from ~/.cache/quickshell/settings_prefs.json. +Falls back to .bak files if primary is corrupted. +Prints valid JSON to stdout. +""" + +import os +import sys +import json +import shutil + +def try_load(path: str): + if not os.path.isfile(path) or os.path.getsize(path) == 0: + return None + try: + with open(path, "r", encoding="utf-8") as f: + data = json.load(f) + return data + except Exception: + return None + +def main(): + home = os.path.expanduser("~") + primary_config = os.path.join(home, ".config", "agility-shell", "settings_prefs.json") + primary_bak = primary_config + ".bak" + cache_config = os.path.join(home, ".cache", "quickshell", "settings_prefs.json") + cache_bak = cache_config + ".bak" + + data = None + source = None + + # 1. Try primary durable config + data = try_load(primary_config) + if data is not None: + source = "primary" + + # 2. If primary missing or corrupted, try primary .bak + if data is None: + data = try_load(primary_bak) + if data is not None: + source = "primary_bak" + + # 3. If still missing, check cache for initial automatic migration + if data is None: + data = try_load(cache_config) + if data is not None: + source = "cache_migration" + try: + os.makedirs(os.path.dirname(primary_config), exist_ok=True) + with open(primary_config, "w", encoding="utf-8") as f: + json.dump(data, f, indent=2, ensure_ascii=False) + except Exception: + pass + + # 4. If still missing, check cache .bak + if data is None: + data = try_load(cache_bak) + if data is not None: + source = "cache_bak" + + if data is not None: + # Also ensure cache is in sync with primary + if source in ("primary", "primary_bak") and not os.path.isfile(cache_config): + try: + os.makedirs(os.path.dirname(cache_config), exist_ok=True) + shutil.copy2(primary_config, cache_config) + except Exception: + pass + + print(json.dumps(data)) + sys.exit(0) + else: + # No valid settings file found + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/quickshell/agility/Core/Services/scripts/save_settings.py b/quickshell/agility/Core/Services/scripts/save_settings.py new file mode 100755 index 00000000..c706c215 --- /dev/null +++ b/quickshell/agility/Core/Services/scripts/save_settings.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python3 +""" +Atomic settings persister for Agility Shell. +Saves settings to ~/.config/agility-shell/settings_prefs.json (primary durable store), +mirrors to ~/.cache/quickshell/settings_prefs.json (runtime cache), +and syncs to /var/tmp/sddm-theme/settings_prefs.json (SDDM greeter theme) with .bak safeguards. +""" + +import sys +import os +import json +import tempfile +import shutil + +def atomic_write(filepath: str, data_str: str, make_backup: bool = True): + target_dir = os.path.dirname(filepath) + os.makedirs(target_dir, exist_ok=True) + + # If existing file is valid, create/update .bak + if make_backup and os.path.isfile(filepath): + try: + if os.path.getsize(filepath) > 0: + bak_path = filepath + ".bak" + shutil.copy2(filepath, bak_path) + except Exception: + pass + + # Write to a temporary file in the same directory so os.replace is atomic (same filesystem) + fd, tmp_path = tempfile.mkstemp(prefix="settings_", suffix=".tmp", dir=target_dir) + try: + with os.fdopen(fd, "w", encoding="utf-8") as f: + f.write(data_str) + f.flush() + os.fsync(f.fileno()) + try: + os.chmod(tmp_path, 0o644) + except Exception: + pass + os.replace(tmp_path, filepath) + except Exception as e: + if os.path.exists(tmp_path): + try: + os.remove(tmp_path) + except Exception: + pass + raise e + +def main(): + if len(sys.argv) < 2: + print("Usage: save_settings.py ''", file=sys.stderr) + sys.exit(1) + + payload = sys.argv[1].strip() + if not payload: + print("Empty payload provided", file=sys.stderr) + sys.exit(1) + + # Validate that payload is valid JSON before writing anything + try: + parsed = json.loads(payload) + formatted_json = json.dumps(parsed, indent=2, ensure_ascii=False) + except Exception as err: + print(f"Error parsing JSON payload: {err}", file=sys.stderr) + sys.exit(1) + + home = os.path.expanduser("~") + primary_config = os.path.join(home, ".config", "agility-shell", "settings_prefs.json") + cache_config = os.path.join(home, ".cache", "quickshell", "settings_prefs.json") + sddm_config = "/var/tmp/sddm-theme/settings_prefs.json" + + # 1. Primary durable write + try: + atomic_write(primary_config, formatted_json, make_backup=True) + except Exception as e: + print(f"Warning: Failed to write to {primary_config}: {e}", file=sys.stderr) + + # 2. Cache mirror write + try: + atomic_write(cache_config, formatted_json, make_backup=True) + except Exception as e: + print(f"Warning: Failed to write to {cache_config}: {e}", file=sys.stderr) + + # 3. SDDM theme mirror write (optional/best-effort) + try: + os.makedirs(os.path.dirname(sddm_config), exist_ok=True) + atomic_write(sddm_config, formatted_json, make_backup=False) + try: + os.chmod(sddm_config, 0o666) + except Exception: + pass + except Exception: + pass + + sys.exit(0) + +if __name__ == "__main__": + main() diff --git a/quickshell/agility/Core/Theme.qml b/quickshell/agility/Core/Theme.qml index 0e936bb8..3e7c7d12 100644 --- a/quickshell/agility/Core/Theme.qml +++ b/quickshell/agility/Core/Theme.qml @@ -115,7 +115,7 @@ QtObject { let json = JSON.stringify(obj); let home = Quickshell.env("HOME"); saver.running = false; - saver.command = ["bash", "-c", "mkdir -p '" + home + "/.cache/quickshell' && echo '" + json + "' > '" + home + "/.cache/quickshell/colorscheme.json'"]; + saver.command = ["bash", "-c", "mkdir -p '" + home + "/.config/agility-shell' '" + home + "/.cache/quickshell' && echo '" + json + "' > '" + home + "/.cache/quickshell/colorscheme.json' && cp '" + home + "/.cache/quickshell/colorscheme.json' '" + home + "/.config/agility-shell/colorscheme.json' 2>/dev/null || true"]; saver.running = true; } @@ -198,7 +198,7 @@ QtObject { } loader: Process { - command: ["cat", Quickshell.env("HOME") + "/.cache/quickshell/colorscheme.json"] + command: ["bash", "-c", "if [ -f \"$HOME/.config/agility-shell/colorscheme.json\" ]; then cat \"$HOME/.config/agility-shell/colorscheme.json\"; elif [ -f \"$HOME/.cache/quickshell/colorscheme.json\" ]; then cat \"$HOME/.cache/quickshell/colorscheme.json\"; fi"] onExited: function(exitCode) { if (exitCode === 0) { try { diff --git a/quickshell/agility/Modules/Settings/BarSettings/BarAppletsSettings.qml b/quickshell/agility/Modules/Settings/BarSettings/BarAppletsSettings.qml index 73a72de0..3fe7fae9 100644 --- a/quickshell/agility/Modules/Settings/BarSettings/BarAppletsSettings.qml +++ b/quickshell/agility/Modules/Settings/BarSettings/BarAppletsSettings.qml @@ -18,9 +18,13 @@ AppContainer { SettingToggle { label: "Enable Active Window Pill" description: "Display the focused application's icon and truncated window title in a compact pill" - checked: SettingsService.appletActiveWindow onCheckedChanged: { - SettingsService.appletActiveWindow = checked; + if (checked !== SettingsService.appletActiveWindow) + SettingsService.appletActiveWindow = checked; + } + + Binding on checked { + value: SettingsService.appletActiveWindow } } @@ -54,9 +58,13 @@ AppContainer { SettingToggle { label: "Enable Dynamic Media Pill" description: "Display playing song and artist inside a dynamic capsule with hover playback controls" - checked: SettingsService.appletDynamicMedia onCheckedChanged: { - SettingsService.appletDynamicMedia = checked; + if (checked !== SettingsService.appletDynamicMedia) + SettingsService.appletDynamicMedia = checked; + } + + Binding on checked { + value: SettingsService.appletDynamicMedia } } @@ -68,9 +76,13 @@ AppContainer { visible: SettingsService.appletDynamicMedia label: "Live Cava Audio Visualizer" description: "Show 4-bar bouncing visualizer bars synchronized with audio output" - checked: SettingsService.appletMediaVisualizer onCheckedChanged: { - SettingsService.appletMediaVisualizer = checked; + if (checked !== SettingsService.appletMediaVisualizer) + SettingsService.appletMediaVisualizer = checked; + } + + Binding on checked { + value: SettingsService.appletMediaVisualizer } } } @@ -83,9 +95,13 @@ AppContainer { SettingToggle { label: "Enable Weather Pill" description: "Display live weather condition icon and temperature beside the clock that expands into a 3-day card" - checked: SettingsService.appletWeather onCheckedChanged: { - SettingsService.appletWeather = checked; + if (checked !== SettingsService.appletWeather) + SettingsService.appletWeather = checked; + } + + Binding on checked { + value: SettingsService.appletWeather } } @@ -119,9 +135,13 @@ AppContainer { SettingToggle { label: "Enable Battery Pill" description: "Display battery capsule with pulse charging animation and level indicator" - checked: SettingsService.appletBattery onCheckedChanged: { - SettingsService.appletBattery = checked; + if (checked !== SettingsService.appletBattery) + SettingsService.appletBattery = checked; + } + + Binding on checked { + value: SettingsService.appletBattery } } @@ -133,9 +153,13 @@ AppContainer { visible: SettingsService.appletBattery label: "Show Discharge / Charge Time" description: "Display estimated remaining hours and minutes (e.g. ⚡ 85% • 3h 15m)" - checked: SettingsService.appletBatteryShowTime onCheckedChanged: { - SettingsService.appletBatteryShowTime = checked; + if (checked !== SettingsService.appletBatteryShowTime) + SettingsService.appletBatteryShowTime = checked; + } + + Binding on checked { + value: SettingsService.appletBatteryShowTime } } } @@ -148,9 +172,13 @@ AppContainer { SettingToggle { label: "Network Traffic Monitor" description: "Display real-time upload and download speeds on the bar" - checked: SettingsService.appletNetwork onCheckedChanged: { - SettingsService.appletNetwork = checked; + if (checked !== SettingsService.appletNetwork) + SettingsService.appletNetwork = checked; + } + + Binding on checked { + value: SettingsService.appletNetwork } } @@ -160,9 +188,13 @@ AppContainer { SettingToggle { label: "Do Not Disturb (DND) Pill" description: "Quick 1-click toggle on the bar to suppress notification popups and banners" - checked: SettingsService.appletDnd onCheckedChanged: { - SettingsService.appletDnd = checked; + if (checked !== SettingsService.appletDnd) + SettingsService.appletDnd = checked; + } + + Binding on checked { + value: SettingsService.appletDnd } } } diff --git a/quickshell/agility/Modules/Settings/BarSettings/BarSettings.qml b/quickshell/agility/Modules/Settings/BarSettings/BarSettings.qml index d2913414..0e8e2076 100644 --- a/quickshell/agility/Modules/Settings/BarSettings/BarSettings.qml +++ b/quickshell/agility/Modules/Settings/BarSettings/BarSettings.qml @@ -60,9 +60,13 @@ AppContainer { visible: SettingsService.barIslandMode || SettingsService.barPillMode label: "Auto-hide Bar" description: "Smoothly slide the bar out of view when a window is open, reveal when hovered or screen is empty" - checked: SettingsService.barAutoHide onCheckedChanged: { - SettingsService.barAutoHide = checked; + if (checked !== SettingsService.barAutoHide) + SettingsService.barAutoHide = checked; + } + + Binding on checked { + value: SettingsService.barAutoHide } } @@ -72,9 +76,13 @@ AppContainer { SettingToggle { label: "Open on Hover" description: "Automatically open menus and popups when hovering over bar widgets without needing to click" - checked: SettingsService.barOpenOnHover onCheckedChanged: { - SettingsService.barOpenOnHover = checked; + if (checked !== SettingsService.barOpenOnHover) + SettingsService.barOpenOnHover = checked; + } + + Binding on checked { + value: SettingsService.barOpenOnHover } } @@ -391,27 +399,39 @@ AppContainer { SettingToggle { label: "24-Hour Time" description: "Use 24-hour time format instead of 12-hour AM/PM" - checked: SettingsService.clock24h onCheckedChanged: { - SettingsService.clock24h = checked; + if (checked !== SettingsService.clock24h) + SettingsService.clock24h = checked; + } + + Binding on checked { + value: SettingsService.clock24h } } SettingToggle { label: "Show Seconds" description: "Display seconds on the main clock" - checked: SettingsService.clockSeconds onCheckedChanged: { - SettingsService.clockSeconds = checked; + if (checked !== SettingsService.clockSeconds) + SettingsService.clockSeconds = checked; + } + + Binding on checked { + value: SettingsService.clockSeconds } } SettingToggle { label: "Show Date" description: "Display the current date next to the clock" - checked: SettingsService.clockShowDate onCheckedChanged: { - SettingsService.clockShowDate = checked; + if (checked !== SettingsService.clockShowDate) + SettingsService.clockShowDate = checked; + } + + Binding on checked { + value: SettingsService.clockShowDate } } diff --git a/quickshell/agility/Modules/Settings/EffectsSettings/EffectsSettings.qml b/quickshell/agility/Modules/Settings/EffectsSettings/EffectsSettings.qml index e23188a7..a2c31ac7 100644 --- a/quickshell/agility/Modules/Settings/EffectsSettings/EffectsSettings.qml +++ b/quickshell/agility/Modules/Settings/EffectsSettings/EffectsSettings.qml @@ -45,13 +45,18 @@ AppContainer { SettingToggle { label: "System Sound Effects" description: "Play audio feedback for startup, popups, battery plug/unplug, notifications, and shell events" - checked: SettingsService.soundEffectsEnabled onCheckedChanged: { - SettingsService.soundEffectsEnabled = checked; - if (checked) { - SoundService.play("confirm"); + if (checked !== SettingsService.soundEffectsEnabled) { + SettingsService.soundEffectsEnabled = checked; + if (checked) { + SoundService.play("confirm"); + } } } + + Binding on checked { + value: SettingsService.soundEffectsEnabled + } } Divider { diff --git a/quickshell/agility/Modules/Settings/IntegrationsSettings/IntegrationsSettings.qml b/quickshell/agility/Modules/Settings/IntegrationsSettings/IntegrationsSettings.qml index 8f3a8387..832e274c 100644 --- a/quickshell/agility/Modules/Settings/IntegrationsSettings/IntegrationsSettings.qml +++ b/quickshell/agility/Modules/Settings/IntegrationsSettings/IntegrationsSettings.qml @@ -187,9 +187,13 @@ AppContainer { SettingToggle { label: "Bluetooth on Startup" description: "Automatically enable Bluetooth adapter when starting Agility Shell (disabled by default to preserve battery and privacy)" - checked: SettingsService.bluetoothOnStartup onCheckedChanged: { - SettingsService.bluetoothOnStartup = checked; + if (checked !== SettingsService.bluetoothOnStartup) + SettingsService.bluetoothOnStartup = checked; + } + + Binding on checked { + value: SettingsService.bluetoothOnStartup } } } diff --git a/quickshell/agility/Modules/Settings/scripts/sync_shortcuts.py b/quickshell/agility/Modules/Settings/scripts/sync_shortcuts.py index dc21f76c..67e7f5bd 100644 --- a/quickshell/agility/Modules/Settings/scripts/sync_shortcuts.py +++ b/quickshell/agility/Modules/Settings/scripts/sync_shortcuts.py @@ -5,7 +5,9 @@ import sys HOME = os.path.expanduser("~") -PREFS_PATH = os.path.join(HOME, ".cache/quickshell/settings_prefs.json") +PRIMARY_PREFS = os.path.join(HOME, ".config/agility-shell/settings_prefs.json") +CACHE_PREFS = os.path.join(HOME, ".cache/quickshell/settings_prefs.json") +PREFS_PATH = PRIMARY_PREFS if os.path.isfile(PRIMARY_PREFS) else CACHE_PREFS NIRI_CONFIG_PATH = os.path.join(HOME, ".config/agility-shell/config/niri.kdl") DEFAULT_ACTION_SHORTCUTS = [ diff --git a/quickshell/agility/Scripts/system/toggle_kb_layout.sh b/quickshell/agility/Scripts/system/toggle_kb_layout.sh index 4027b458..616fdd8b 100755 --- a/quickshell/agility/Scripts/system/toggle_kb_layout.sh +++ b/quickshell/agility/Scripts/system/toggle_kb_layout.sh @@ -1,7 +1,10 @@ #!/bin/bash # Parse enabled layouts from settings -PREFS_FILE="$HOME/.cache/quickshell/settings_prefs.json" +PREFS_FILE="$HOME/.config/agility-shell/settings_prefs.json" +if [ ! -f "$PREFS_FILE" ]; then + PREFS_FILE="$HOME/.cache/quickshell/settings_prefs.json" +fi LAYOUTS_STR=$(jq -r '.enabledKbLayouts | join(" ")' "$PREFS_FILE" 2>/dev/null) if [ -z "$LAYOUTS_STR" ] || [ "$LAYOUTS_STR" == "null" ]; then