Skip to content

Commit 9aa2d42

Browse files
committed
🐛 fix: The configuration for the home screen wizard was being overwritten by the start[DE]-community script; now it's saved in the [DE].settings file
1 parent 011f8b9 commit 9aa2d42

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

biglinux-livecd/usr/share/biglinux/livecd/services.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,29 @@ def apply_simple_theme(self, theme: str):
185185
logger.info(f"Applying simple theme: {theme}")
186186
self._write_tmp_file(self.tmp_simple_theme_file, theme)
187187

188+
# Wait for dconf to be ready
189+
import time
190+
max_retries = 5
191+
for i in range(max_retries):
192+
success, _ = self._run_command(["dconf", "list", "/"], read_only=True)
193+
if success:
194+
logger.info("dconf is ready")
195+
break
196+
logger.warning(f"dconf not ready, waiting... (attempt {i+1}/{max_retries})")
197+
time.sleep(1)
198+
else:
199+
logger.error("dconf failed to become ready after 5 attempts")
200+
188201
desktop_env = self.get_desktop_environment()
189202

190203
if theme == "dark":
191204
self._apply_dark_theme(desktop_env)
192205
else:
193206
self._apply_light_theme(desktop_env)
194207

208+
# Save dconf settings to the appropriate file so they persist after dconf reset
209+
self._save_dconf_settings(desktop_env)
210+
195211
def _apply_dark_theme(self, desktop_env: str):
196212
"""Applies dark theme configuration."""
197213
logger.info("Applying dark theme configuration")
@@ -412,6 +428,41 @@ def _set_icon_theme(self, desktop_env: str, theme_name: str):
412428
f"'{theme_name}'"
413429
])
414430

431+
def _save_dconf_settings(self, desktop_env: str):
432+
"""
433+
Saves current dconf settings to the appropriate file for the desktop environment.
434+
This ensures settings persist even after the start scripts do 'dconf reset -f /'.
435+
"""
436+
home = os.path.expanduser("~")
437+
dconf_dir = os.path.join(home, ".config", "dconf")
438+
439+
# Determine the correct settings file based on desktop environment
440+
if desktop_env == "Cinnamon":
441+
settings_file = os.path.join(dconf_dir, "settings.cinnamon")
442+
elif desktop_env == "GNOME":
443+
settings_file = os.path.join(dconf_dir, "settings.gnome")
444+
elif desktop_env == "XFCE":
445+
settings_file = os.path.join(dconf_dir, "settings.xfce")
446+
else:
447+
logger.warning(f"Unknown desktop environment: {desktop_env}, not saving dconf settings")
448+
return
449+
450+
logger.info(f"Saving dconf settings to: {settings_file}")
451+
452+
# Ensure dconf directory exists
453+
if not self.test_mode:
454+
os.makedirs(dconf_dir, exist_ok=True)
455+
456+
# Dump current dconf settings
457+
success, dconf_dump = self._run_command(["dconf", "dump", "/"], read_only=True)
458+
459+
if success and dconf_dump:
460+
# Write to settings file
461+
self._write_user_config_file(settings_file, dconf_dump)
462+
logger.info(f"Successfully saved dconf settings for {desktop_env}")
463+
else:
464+
logger.error(f"Failed to dump dconf settings for {desktop_env}")
465+
415466
def finalize_setup(self, config: SetupConfig):
416467
"""
417468
Performs final setup steps, including creating flag files.

0 commit comments

Comments
 (0)