Skip to content

Commit dccb5b6

Browse files
authored
Add support for budgie desktop (#100)
- Log colour scheme, and current theme - Detect variant correctly - Wait for 1 sec before updating GUI status
1 parent ff5c3b3 commit dccb5b6

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

src/ThemeManager/DesktopTheme.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,25 @@ def set_desktop_theme(self, state: Dict, nexttheme: list):
9393
}
9494
self.apply_theme_map(mapping)
9595

96+
elif de in ["budgie", "budgie:gnome"]:
97+
mapping = {
98+
"com.solus-project.gsettings-daemon.plugins.polkit": ("theme", nexttheme[4]),
99+
"org.gnome.desktop.interface": [
100+
("gtk-theme", nexttheme[4]),
101+
("icon-theme", nexttheme[7]),
102+
("cursor-theme", nexttheme[8]),
103+
("color-scheme", nexttheme[6]),
104+
],
105+
"org.gnome.desktop.wm.preferences": ("theme", nexttheme[5])
106+
}
107+
# Optional: Budgie-specific 'Desktop' theme (the panel look)
108+
try:
109+
self.set_gsetting("com.solus-project.budgie-panel", "theme", nexttheme[3])
110+
except Exception:
111+
pass
112+
113+
self.apply_theme_map(mapping)
114+
96115
elif de in ["gnome", "ubuntu:gnome", "unity"]:
97116
self.apply_gnome_theme(nexttheme)
98117

@@ -126,6 +145,7 @@ def set_desktop_theme(self, state: Dict, nexttheme: list):
126145
"Icon": nexttheme[7],
127146
"Cursor": nexttheme[8],
128147
"Plank": nexttheme[9],
148+
"Color scheme": nexttheme[6],
129149
})
130150

131151
except Exception as e:
@@ -173,6 +193,12 @@ def get_desktop_theme(self, state: Dict, systheme: str, colvariants: list) -> Di
173193
themes = {}
174194

175195
schema_map = {
196+
"budgie": {
197+
"Applications": "org.gnome.desktop.interface gtk-theme",
198+
"Decoration": "org.gnome.desktop.wm.preferences theme",
199+
"Icon": "org.gnome.desktop.interface icon-theme",
200+
"Cursor": "org.gnome.desktop.interface cursor-theme",
201+
},
176202
"x-cinnamon": {
177203
"Applications": "org.cinnamon.desktop.interface gtk-theme",
178204
"Decoration": "org.cinnamon.desktop.wm.preferences theme",
@@ -211,7 +237,7 @@ def get_desktop_theme(self, state: Dict, systheme: str, colvariants: list) -> Di
211237
# Detect variant
212238
variant = "Default"
213239
for v in colvariants:
214-
if v and v.lower() in themes.get("System", "").lower():
240+
if v and v.lower() in themes.get("Applications", "").lower():
215241
variant = v
216242
break
217243

src/ThemeManager/gui.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ def on_random_button(self, widget):
285285
self.state = self.manager.get_state_info()
286286
self.nexttheme = self.manager.prep_theme_variants(self.state, self.theme_styles)
287287
self.destop_manager.set_desktop_theme(self.state, self.nexttheme)
288+
# Wait 1 sec before updating current theme in GUI
289+
import time
290+
time.sleep(1)
288291
self.currenttheme = self.destop_manager.get_desktop_theme(self.state, self.manager.systemthemename, self.manager.colvariants)
289292
self.current_status()
290293

@@ -338,7 +341,7 @@ def current_status(self):
338341
'''
339342
Show current theme info in status bar.
340343
'''
341-
module_logger.debug(("%s", self.currenttheme))
344+
module_logger.debug(_("Current Themes: %s" % self.currenttheme))
342345
status = "DE: %s, \tState: %s, \tVariant: %s, \tLast Updated: %s, \tThemes: %s" % (self.state['DE'], self.state['State'], self.currenttheme["Variant"], "", self.currenttheme["Themes"])
343346

344347
context_id = self.statusbar.get_context_id("status")

0 commit comments

Comments
 (0)