Skip to content

Commit d80eeff

Browse files
committed
Update jamesdsp auto enable manager
1 parent 5918c9f commit d80eeff

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,41 @@ def get_desktop_image_path(self, layout_name: str) -> str:
244244
def get_theme_image_path(self, theme_name: str) -> str:
245245
return self.theme_image_path.format(theme_name)
246246

247+
def apply_jamesdsp_settings(self, enabled: bool):
248+
"""
249+
Applies JamesDSP configuration immediately.
250+
This is called when a theme is selected, based on the switch state.
251+
"""
252+
home = os.path.expanduser("~")
253+
jamesdsp_conf = os.path.join(home, ".config/jamesdsp/application.conf")
254+
255+
if enabled:
256+
logger.info("Applying JamesDSP enabled settings...")
257+
self._run_command(["touch", self.tmp_jamesdsp_file], as_root=False)
258+
if os.path.exists(jamesdsp_conf):
259+
self._run_command(
260+
[
261+
"sed",
262+
"-i",
263+
"s|AutoStartEnabled=false|AutoStartEnabled=true|g",
264+
jamesdsp_conf,
265+
],
266+
as_root=False,
267+
)
268+
else:
269+
logger.info("Applying JamesDSP disabled settings...")
270+
self._run_command(["rm", "-f", self.tmp_jamesdsp_file], as_root=False)
271+
if os.path.exists(jamesdsp_conf):
272+
self._run_command(
273+
[
274+
"sed",
275+
"-i",
276+
"s|AutoStartEnabled=true|AutoStartEnabled=false|g",
277+
jamesdsp_conf,
278+
],
279+
as_root=False,
280+
)
281+
247282
def check_jamesdsp_availability(self) -> bool:
248283
"""Checks if JamesDSP executable exists."""
249284
return os.path.exists("/usr/bin/jamesdsp")

biglinux-livecd/usr/share/biglinux/livecd/ui/app_window.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,9 @@ def _on_theme_selected(self, view, theme):
417417
if theme_view:
418418
self.config.enable_jamesdsp = theme_view.is_jamesdsp_enabled()
419419
self.config.enable_enhanced_contrast = theme_view.is_contrast_enabled()
420+
421+
# Apply JamesDSP settings immediately when theme is selected
422+
self.system_service.apply_jamesdsp_settings(self.config.enable_jamesdsp)
420423

421424
self.system_service.finalize_setup(self.config)
422425
self.close()

0 commit comments

Comments
 (0)