@@ -33,28 +33,60 @@ def __init__(self, test_mode: bool = False):
3333 self .tmp_theme_file = "/tmp/big_desktop_theme"
3434
3535 def _run_command (
36- self , command : List [str ], as_root : bool = False , read_only : bool = False
36+ self ,
37+ command : List [str ],
38+ as_root : bool = False ,
39+ read_only : bool = False ,
40+ wait_for_completion : bool = False ,
3741 ) -> Tuple [bool , str ]:
38- """Helper to run external commands, respecting test mode for non-read-only actions."""
42+ """
43+ Helper to run external commands.
44+ - If wait_for_completion or read_only is True, it runs synchronously and returns output.
45+ - Otherwise, it runs in the background (asynchronously) and detaches.
46+ """
3947 if self .test_mode and not read_only :
4048 print (
4149 f"[TEST MODE] Suppressed command: { 'sudo ' if as_root else '' } { ' ' .join (command )} "
4250 )
4351 return True , ""
4452
53+ if read_only :
54+ wait_for_completion = True
55+
4556 if as_root :
4657 command .insert (0 , "sudo" )
58+
4759 try :
48- result = subprocess .run (
49- command , capture_output = True , text = True , check = True , encoding = "utf-8"
50- )
51- return True , result .stdout .strip ()
60+ if wait_for_completion :
61+ # Run synchronously and capture output (for read-only commands)
62+ result = subprocess .run (
63+ command ,
64+ capture_output = True ,
65+ text = True ,
66+ check = True ,
67+ encoding = "utf-8" ,
68+ )
69+ return True , result .stdout .strip ()
70+ else :
71+ # Run in the background and detach
72+ # Redirect stdout/stderr to /dev/null to prevent terminal clutter
73+ subprocess .Popen (
74+ command , stdout = subprocess .DEVNULL , stderr = subprocess .DEVNULL
75+ )
76+ return True , "" # Assume success on launch
5277 except FileNotFoundError :
53- print (f"Error: Command not found: { command [0 ]} " )
54- return False , f"Command not found: { command [0 ]} "
78+ err_msg = f"Command not found: { command [0 ]} "
79+ print (f"Error: { err_msg } " )
80+ return False , err_msg
5581 except subprocess .CalledProcessError as e :
56- print (f"Error running command '{ ' ' .join (e .cmd )} ': { e .stderr } " )
82+ err_msg = f"Error running command '{ ' ' .join (e .cmd )} ': { e .stderr } "
83+ print (err_msg )
5784 return False , e .stderr .strip ()
85+ except Exception as e :
86+ err_msg = f"An unexpected error occurred with command '{ ' ' .join (command )} ': { e } "
87+ print (err_msg )
88+ return False , str (e )
89+
5890
5991 def _write_tmp_file (self , filepath : str , content : str ):
6092 """Helper to write to a temp file."""
@@ -93,10 +125,7 @@ def apply_language_settings(self, lang_code: str, timezone: str):
93125 self ._run_command (
94126 ["localectl" , "set-locale" , f"LANG={ lang_code } .UTF-8" ], as_root = True
95127 )
96- self ._run_command (["./script/biglinux-verify-md5sum.sh" ], as_root = False )
97-
98-
99-
128+ self ._run_command (["/usr/share/biglinux/livecd/script/biglinux-verify-md5sum.sh" ], as_root = False )
100129
101130 def apply_keyboard_layout (self , layout : str ):
102131 """Applies the selected keyboard layout."""
@@ -153,16 +182,20 @@ def finalize_setup(self, config: SetupConfig):
153182 if config .enable_jamesdsp :
154183 print ("JamesDSP enabled, creating flag file." )
155184 self ._run_command (["touch" , "/etc/big_enable_jamesdsp" ], as_root = True )
185+ self ._run_command (["sed" , "-i" , "s|AutoStartEnabled=false|AutoStartEnabled=true|g" , "~/.config/jamesdsp/application.conf" ], as_root = False )
156186 else :
157187 print ("JamesDSP not enabled, removing flag file if it exists." )
158188 self ._run_command (["rm" , "-f" , "/etc/big_enable_jamesdsp" ], as_root = True )
189+ self ._run_command (["sed" , "-i" , "s|AutoStartEnabled=true|AutoStartEnabled=false|g" , "~/.config/jamesdsp/application.conf" ], as_root = False )
159190
160191 if config .enable_enhanced_contrast :
161192 print ("Enhanced contrast enabled, creating flag file." )
162193 self ._run_command (["touch" , "/etc/big_improve_constrast" ], as_root = True )
194+ self ._run_command (["/usr/share/biglinux/livecd/script/icc_enable.sh" ], as_root = False )
163195 else :
164196 print ("Enhanced contrast not enabled, removing flag file if it exists." )
165197 self ._run_command (["rm" , "-f" , "/etc/big_improve_constrast" ], as_root = True )
198+ self ._run_command (["/usr/share/biglinux/livecd/script/icc_disable.sh" ], as_root = False )
166199
167200 self ._run_command (["killall" , "kwin_wayland" ])
168201
@@ -178,7 +211,7 @@ def check_jamesdsp_availability(self) -> bool:
178211
179212 def check_enhanced_contrast_availability (self ) -> bool :
180213 """Checks for the AppleRGB ICC profile and if kwin_wayland is running."""
181- icc_profile_exists = os .path .exists ("/usr/share/color/icc/colord/AppleRGB .icc" )
214+ icc_profile_exists = os .path .exists ("/usr/share/color/icc/colord/ECI-RGBv1 .icc" )
182215
183216 # Check if kwin_wayland process is running
184217 try :
0 commit comments