Skip to content

Commit 4fe9cac

Browse files
committed
Fix ICC contrast configuration
1 parent d80eeff commit 4fe9cac

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,28 @@ def apply_jamesdsp_settings(self, enabled: bool):
279279
as_root=False,
280280
)
281281

282+
def apply_icc_profile_settings(self, enabled: bool):
283+
"""
284+
Applies ICC profile configuration immediately.
285+
This is called when a theme is selected, based on the switch state.
286+
"""
287+
if enabled:
288+
logger.info("Applying ICC profile enabled settings...")
289+
self._run_command(["touch", self.tmp_display_profile_file], as_root=False)
290+
self._run_command(
291+
["/usr/bin/icc_profile_apply", "enable"],
292+
as_root=False,
293+
)
294+
else:
295+
logger.info("Applying ICC profile disabled settings...")
296+
self._run_command(
297+
["rm", "-f", self.tmp_display_profile_file], as_root=False
298+
)
299+
self._run_command(
300+
["/usr/bin/icc_profile_apply", "disable"],
301+
as_root=False,
302+
)
303+
282304
def check_jamesdsp_availability(self) -> bool:
283305
"""Checks if JamesDSP executable exists."""
284306
return os.path.exists("/usr/bin/jamesdsp")

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class ThemeView(BaseItemView):
3232
def __init__(self, system_service: SystemService, **kwargs):
3333
self.jamesdsp_switch = None
3434
self.contrast_switch = None
35+
self._system_service = system_service # Store reference for ICC callbacks
3536

3637
self.jamesdsp_available = system_service.check_jamesdsp_availability()
3738
self.contrast_available = system_service.check_enhanced_contrast_availability()
@@ -183,6 +184,8 @@ def _create_contrast_card(self, parent_box):
183184
self.contrast_switch = Gtk.Switch(
184185
valign=Gtk.Align.CENTER, active=self.default_contrast_state
185186
)
187+
# Connect callback to apply ICC profile immediately when switch state changes
188+
self.contrast_switch.connect("notify::active", self._on_contrast_switch_toggled)
186189
content.append(self.contrast_switch)
187190

188191
controller = Gtk.GestureClick.new()
@@ -262,3 +265,9 @@ def is_contrast_enabled(self) -> bool:
262265
if self.contrast_switch:
263266
return self.contrast_switch.get_active()
264267
return False
268+
269+
def _on_contrast_switch_toggled(self, switch, param):
270+
"""Called immediately when the ICC profile switch state changes."""
271+
enabled = switch.get_active()
272+
logger.info(f"ICC profile switch toggled: {'enabled' if enabled else 'disabled'}")
273+
self._system_service.apply_icc_profile_settings(enabled)

0 commit comments

Comments
 (0)