Skip to content

Commit c8fc233

Browse files
committed
🔨 refactor: Includes option for light and dark themes for Cinnamon, Gnome, and XFCE
1 parent fc23861 commit c8fc233

9 files changed

Lines changed: 431 additions & 5 deletions

File tree

‎.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,7 @@ cython_debug/
161161

162162
# PyPI configuration file
163163
.pypirc
164+
165+
# Claude Code
166+
.claude
167+
CLAUDE.md

‎biglinux-livecd/locale/biglinux-livecd.pot‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,18 @@ msgstr ""
123123
# File: biglinux-livecd/biglinux-livecd/usr/share/biglinux/livecd/ui/theme_view.py, line: 201
124124
msgid "Choose a System Theme"
125125
msgstr ""
126+
127+
#
128+
# File: biglinux-livecd/biglinux-livecd/usr/share/biglinux/livecd/ui/simple_theme_view.py, line: 51
129+
msgid "Choose a Theme Style"
130+
msgstr ""
131+
132+
#
133+
# File: biglinux-livecd/biglinux-livecd/usr/share/biglinux/livecd/ui/simple_theme_view.py, line: 70
134+
msgid "Light Theme"
135+
msgstr ""
136+
137+
#
138+
# File: biglinux-livecd/biglinux-livecd/usr/share/biglinux/livecd/ui/simple_theme_view.py, line: 76
139+
msgid "Dark Theme"
140+
msgstr ""

‎biglinux-livecd/locale/en.po‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,18 @@ msgstr "Enable enhanced contrast"
130130
# File: biglinux-livecd/biglinux-livecd/usr/share/biglinux/livecd/ui/theme_view.py, line: 201
131131
msgid "Choose a System Theme"
132132
msgstr "Choose a System Theme"
133+
134+
#
135+
# File: biglinux-livecd/biglinux-livecd/usr/share/biglinux/livecd/ui/simple_theme_view.py, line: 51
136+
msgid "Choose a Theme Style"
137+
msgstr "Choose a Theme Style"
138+
139+
#
140+
# File: biglinux-livecd/biglinux-livecd/usr/share/biglinux/livecd/ui/simple_theme_view.py, line: 70
141+
msgid "Light Theme"
142+
msgstr "Light Theme"
143+
144+
#
145+
# File: biglinux-livecd/biglinux-livecd/usr/share/biglinux/livecd/ui/simple_theme_view.py, line: 76
146+
msgid "Dark Theme"
147+
msgstr "Dark Theme"

‎biglinux-livecd/locale/pt.po‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,18 @@ msgstr "Ativar contraste aprimorado"
9292
# File: biglinux-livecd/biglinux-livecd/usr/share/biglinux/livecd/ui/theme_view.py, line: 166
9393
msgid "Choose a System Theme"
9494
msgstr "Escolha um Tema do Sistema"
95+
96+
#
97+
# File: biglinux-livecd/biglinux-livecd/usr/share/biglinux/livecd/ui/simple_theme_view.py, line: 51
98+
msgid "Choose a Theme Style"
99+
msgstr "Escolha um Estilo de Tema"
100+
101+
#
102+
# File: biglinux-livecd/biglinux-livecd/usr/share/biglinux/livecd/ui/simple_theme_view.py, line: 70
103+
msgid "Light Theme"
104+
msgstr "Tema Claro"
105+
106+
#
107+
# File: biglinux-livecd/biglinux-livecd/usr/share/biglinux/livecd/ui/simple_theme_view.py, line: 76
108+
msgid "Dark Theme"
109+
msgstr "Tema Escuro"

‎biglinux-livecd/usr/share/biglinux/livecd/config.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ class SetupConfig:
1515
keyboard_layout: Optional[str] = None
1616
desktop_layout: Optional[str] = None
1717
theme: Optional[str] = None
18+
simple_theme: Optional[str] = None # "light" or "dark" for simplified environments
1819
enable_jamesdsp: bool = False
1920
enable_enhanced_contrast: bool = False

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

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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]\ntheme=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]\ntheme=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.

‎biglinux-livecd/usr/share/biglinux/livecd/style.css‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,27 @@ gridview child:selected {
114114
outline-color: alpha(@theme_selected_bg_color, 0.5);
115115
background-color: alpha(@theme_selected_bg_color, 0.05);
116116
}
117+
118+
/* Simple Theme View Cards */
119+
.theme-card {
120+
background-color: @headerbar_bg_color;
121+
border-radius: 14px;
122+
padding: 20px;
123+
outline: 2px solid transparent;
124+
outline-offset: -2px;
125+
transition: all 0.2s ease;
126+
}
127+
128+
.theme-card:hover,
129+
.theme-card-hover {
130+
outline-color: alpha(@theme_selected_bg_color, 0.5);
131+
background-color: alpha(@theme_selected_bg_color, 0.05);
132+
transform: translateY(-3px);
133+
box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.3);
134+
}
135+
136+
.theme-card picture {
137+
border-radius: 10px;
138+
background-image: linear-gradient(to bottom, #202020 0%, #222222 90%, #191919 100%);
139+
box-shadow: 0px 3px 0px #2a2a2a, 0px 4px 10px rgba(0, 0, 0, 0.6);
140+
}

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

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from ui.keyboard_view import KeyboardView
1212
from ui.desktop_view import DesktopView
1313
from ui.theme_view import ThemeView
14+
from ui.simple_theme_view import SimpleThemeView
1415
from logging_config import get_logger
1516
import os
1617

@@ -132,6 +133,7 @@ def _build_ui(self):
132133
self.steps = [
133134
{"name": "language", "file": "headerbar-locale.svg"},
134135
{"name": "keyboard", "file": "headerbar-keyboard.svg"},
136+
{"name": "theme", "file": "headerbar-theme.svg"},
135137
]
136138
else:
137139
self.steps = [
@@ -143,7 +145,7 @@ def _build_ui(self):
143145

144146
# Build header layout based on environment
145147
if self.is_simplified_env:
146-
# Simplified layout: [Language] [comm-logo.png] [Keyboard]
148+
# Simplified layout: [Language] [comm-logo.png] [Keyboard] [Theme]
147149
self._add_step_button(header_content_box, self.steps[0])
148150

149151
# Use comm-logo.png for simplified environments (XivaStudio override if exists)
@@ -154,8 +156,9 @@ def _build_ui(self):
154156
logo.set_margin_start(20)
155157
logo.set_margin_end(20)
156158
header_content_box.append(logo)
157-
159+
158160
self._add_step_button(header_content_box, self.steps[1])
161+
self._add_step_button(header_content_box, self.steps[2])
159162
else:
160163
# Full layout: [Language] [Keyboard] [logo.png] [Desktop] [Theme]
161164
self._add_step_button(header_content_box, self.steps[0])
@@ -215,6 +218,8 @@ def _retranslate_ui(self):
215218
page.set_title(_("Desktop Layout"))
216219
elif view_name == "theme":
217220
page.set_title(_("Theme"))
221+
elif view_name == "simple_theme":
222+
page.set_title(_("Theme"))
218223

219224
# Trigger re-translation within the view itself
220225
if hasattr(view, "_retranslate_ui"):
@@ -229,6 +234,8 @@ def _ensure_view(self, view_name: str, *args):
229234
self._add_desktop_view()
230235
elif view_name == "theme":
231236
self._add_theme_view()
237+
elif view_name == "simple_theme":
238+
self._add_simple_theme_view()
232239

233240
def _add_step_button(self, box, step_info):
234241
button = Gtk.Button()
@@ -366,9 +373,9 @@ def _on_keyboard_selected(self, view, layout):
366373
self.completed_steps.add("keyboard")
367374

368375
if self.is_simplified_env:
369-
# Skip desktop and theme for simplified environments (GNOME/XFCE/Cinnamon)
370-
self.system_service.finalize_setup(self.config)
371-
self.close()
376+
# Navigate to simple theme view for simplified environments (GNOME/XFCE/Cinnamon)
377+
self._ensure_view("simple_theme")
378+
self.stack.set_visible_child_name("simple_theme")
372379
else:
373380
# LAZY LOADING: Ensure desktop view exists before showing it
374381
self._ensure_view("desktop")
@@ -415,6 +422,29 @@ def _on_theme_selected(self, view, theme):
415422
self.system_service.finalize_setup(self.config)
416423
self.close()
417424

425+
def _add_simple_theme_view(self):
426+
"""Creates and adds the simplified theme view for GNOME/XFCE/Cinnamon."""
427+
view = SimpleThemeView(system_service=self.system_service)
428+
view.connect("theme-selected", self._on_simple_theme_selected)
429+
self.stack.add_titled(view, "simple_theme", _("Theme"))
430+
431+
def _on_simple_theme_selected(self, view, theme):
432+
"""Handle theme selection from simplified theme view."""
433+
logger.info(f"Simple theme selected: {theme}")
434+
435+
# Mark theme step as completed
436+
self.completed_steps.add("theme")
437+
438+
# Save to config
439+
self.config.simple_theme = theme
440+
441+
# Apply theme via SystemService
442+
self.system_service.apply_simple_theme(theme)
443+
444+
# Finalize and close
445+
self.system_service.finalize_setup(self.config)
446+
self.close()
447+
418448
def _on_key_press_event(self, controller, keyval, keycode, state):
419449
current_view = self.stack.get_visible_child()
420450
if isinstance(current_view, LanguageView):

0 commit comments

Comments
 (0)