@@ -38,6 +38,7 @@ def __init__(self, test_mode: bool = False):
3838 self .tmp_theme_file = "/tmp/big_desktop_theme"
3939 self .tmp_jamesdsp_file = "/tmp/big_enable_jamesdsp"
4040 self .tmp_display_profile_file = "/tmp/big_improve_display"
41+ self .tmp_simple_theme_file = "/tmp/big_simple_theme"
4142
4243 def _run_command (
4344 self ,
@@ -174,6 +175,167 @@ def apply_theme(self, theme: str):
174175 self ._write_tmp_file (self .tmp_theme_file , theme )
175176 self ._run_command ([self .theme_apply_script , theme ])
176177
178+ def apply_simple_theme (self , theme : str ):
179+ """
180+ Applies light or dark theme for simplified environments (GNOME/XFCE/Cinnamon).
181+
182+ Args:
183+ theme: Either "light" or "dark"
184+ """
185+ logger .info (f"Applying simple theme: { theme } " )
186+ self ._write_tmp_file (self .tmp_simple_theme_file , theme )
187+
188+ desktop_env = self .get_desktop_environment ()
189+
190+ if theme == "dark" :
191+ self ._apply_dark_theme (desktop_env )
192+ else :
193+ self ._apply_light_theme (desktop_env )
194+
195+ def _apply_dark_theme (self , desktop_env : str ):
196+ """Applies dark theme configuration."""
197+ logger .info ("Applying dark theme configuration" )
198+
199+ # Set GTK4 color scheme for GNOME/Cinnamon
200+ if desktop_env in ["GNOME" , "Cinnamon" ]:
201+ self ._run_command ([
202+ "dconf" , "write" ,
203+ "/org/gnome/desktop/interface/color-scheme" ,
204+ "'prefer-dark'"
205+ ])
206+
207+ # Configure Kvantum theme
208+ home = os .path .expanduser ("~" )
209+ kvantum_dir = os .path .join (home , ".config" , "Kvantum" )
210+ kvantum_conf = os .path .join (kvantum_dir , "kvantum.kvconfig" )
211+
212+ kvantum_content = "[General]\n theme=BigAdwaitaRoundGtkDark\n "
213+ self ._write_user_config_file (kvantum_conf , kvantum_content )
214+
215+ # Copy kdeglobals for dark theme
216+ kdeglobals_source = "/usr/share/sync-kde-and-gtk-places/biglinux-dark"
217+ kdeglobals_dest = os .path .join (home , ".config" , "kdeglobals" )
218+ if os .path .exists (kdeglobals_source ):
219+ self ._run_command (["cp" , "-f" , kdeglobals_source , kdeglobals_dest ])
220+ else :
221+ logger .warning (f"Dark theme kdeglobals not found at { kdeglobals_source } " )
222+
223+ # Apply dark icon theme
224+ self ._apply_icon_theme_variant (desktop_env , dark = True )
225+
226+ def _apply_light_theme (self , desktop_env : str ):
227+ """Applies light theme configuration."""
228+ logger .info ("Applying light theme configuration" )
229+
230+ # Set GTK4 color scheme for GNOME/Cinnamon
231+ if desktop_env in ["GNOME" , "Cinnamon" ]:
232+ self ._run_command ([
233+ "dconf" , "write" ,
234+ "/org/gnome/desktop/interface/color-scheme" ,
235+ "'default'"
236+ ])
237+
238+ # Configure Kvantum theme
239+ home = os .path .expanduser ("~" )
240+ kvantum_dir = os .path .join (home , ".config" , "Kvantum" )
241+ kvantum_conf = os .path .join (kvantum_dir , "kvantum.kvconfig" )
242+
243+ kvantum_content = "[General]\n theme=BigAdwaitaRoundGtk\n "
244+ self ._write_user_config_file (kvantum_conf , kvantum_content )
245+
246+ # Copy kdeglobals for light theme
247+ kdeglobals_source = "/usr/share/sync-kde-and-gtk-places/biglinux"
248+ kdeglobals_dest = os .path .join (home , ".config" , "kdeglobals" )
249+ if os .path .exists (kdeglobals_source ):
250+ self ._run_command (["cp" , "-f" , kdeglobals_source , kdeglobals_dest ])
251+ else :
252+ logger .warning (f"Light theme kdeglobals not found at { kdeglobals_source } " )
253+
254+ # Apply light icon theme
255+ self ._apply_icon_theme_variant (desktop_env , dark = False )
256+
257+ def _apply_icon_theme_variant (self , desktop_env : str , dark : bool ):
258+ """Applies appropriate icon theme variant (dark or light)."""
259+ logger .debug (f"Applying { 'dark' if dark else 'light' } icon theme variant" )
260+
261+ # Get current icon theme
262+ icon_theme = ""
263+ if desktop_env == "XFCE" :
264+ success , icon_theme = self ._run_command ([
265+ "xfconf-query" , "-c" , "xsettings" ,
266+ "-p" , "/Net/IconThemeName"
267+ ], read_only = True )
268+ if success :
269+ icon_theme = icon_theme .strip ()
270+ else :
271+ # GNOME or Cinnamon
272+ if desktop_env == "Cinnamon" :
273+ success , icon_theme = self ._run_command ([
274+ "dconf" , "read" ,
275+ "/org/cinnamon/desktop/interface/icon-theme"
276+ ], read_only = True )
277+ else :
278+ success , icon_theme = self ._run_command ([
279+ "dconf" , "read" ,
280+ "/org/gnome/desktop/interface/icon-theme"
281+ ], read_only = True )
282+
283+ if success :
284+ icon_theme = icon_theme .strip ("'\" " )
285+
286+ if not icon_theme :
287+ logger .warning ("Could not detect current icon theme" )
288+ return
289+
290+ # Find appropriate variant
291+ home = os .path .expanduser ("~" )
292+ search_paths = [
293+ "/usr/share/icons" ,
294+ os .path .join (home , ".local/share/icons" )
295+ ]
296+
297+ new_theme = icon_theme
298+ if dark :
299+ # Look for dark variant
300+ for base_path in search_paths :
301+ if os .path .exists (base_path ):
302+ # Try adding -dark suffix
303+ dark_icon_path = os .path .join (base_path , f"{ icon_theme } -dark" )
304+ if os .path .isdir (dark_icon_path ):
305+ new_theme = f"{ icon_theme } -dark"
306+ logger .debug (f"Found dark icon theme: { new_theme } " )
307+ break
308+ else :
309+ # Remove -dark suffix if present
310+ new_theme = icon_theme .replace ("-dark" , "" ).replace ("-Dark" , "" )
311+ logger .debug (f"Using light icon theme: { new_theme } " )
312+
313+ # Apply the icon theme
314+ self ._set_icon_theme (desktop_env , new_theme )
315+
316+ def _set_icon_theme (self , desktop_env : str , theme_name : str ):
317+ """Sets the icon theme for the desktop environment."""
318+ logger .info (f"Setting icon theme to: { theme_name } " )
319+
320+ if desktop_env == "Cinnamon" :
321+ self ._run_command ([
322+ "dconf" , "write" ,
323+ "/org/cinnamon/desktop/interface/icon-theme" ,
324+ f"'{ theme_name } '"
325+ ])
326+ elif desktop_env == "XFCE" :
327+ self ._run_command ([
328+ "xfconf-query" , "-c" , "xsettings" ,
329+ "-p" , "/Net/IconThemeName" ,
330+ "-s" , theme_name
331+ ])
332+ else : # GNOME
333+ self ._run_command ([
334+ "dconf" , "write" ,
335+ "/org/gnome/desktop/interface/icon-theme" ,
336+ f"'{ theme_name } '"
337+ ])
338+
177339 def finalize_setup (self , config : SetupConfig ):
178340 """
179341 Performs final setup steps, including creating flag files.
0 commit comments