@@ -156,6 +156,20 @@ def load_config(self):
156
156
self .cursor_colvariants .append (var .strip ().strip ('"' ).strip ("'" ))
157
157
self .cursor_colorvariants = self .cursor_colorvariants .strip ("," ) # removes the last comma, it looks ugly with the comma
158
158
159
+ # Plank Theme
160
+ self .plank_theme = self .config ["system-theme" ].getboolean ('plank-theme' )
161
+ self .plankthemename = self .config ["system-theme" ]['plank-theme-name' ]
162
+ self .plank_darkmode_suffix = self .config ["system-theme" ]['plank-dark-mode-suffix' ]
163
+ self .plank_theme_name_style = int (self .config ["system-theme" ]['plank-theme-style-name' ])
164
+
165
+ colvars = self .config ["system-theme" ]['plank-color-variants' ].split (',' )
166
+ self .plank_colorvariants = "" # This string will be saved in config file
167
+ self .plank_colvariants = [] # This list will be used to randomize variants
168
+ for var in colvars :
169
+ self .plank_colorvariants += str (var + "," )
170
+ self .plank_colvariants .append (var .strip ().strip ('"' ).strip ("'" ))
171
+ self .plank_colorvariants = self .plank_colorvariants .strip ("," ) # removes the last comma, it looks ugly with the comma
172
+
159
173
theme_interval = self .config ["system-theme" ]['theme-interval' ]
160
174
self .theme_interval_HH = int (theme_interval .split (':' )[0 ])
161
175
self .theme_interval_MM = int (theme_interval .split (':' )[1 ])
@@ -182,6 +196,13 @@ def load_config(self):
182
196
self .cursor_colvariants = []
183
197
self .cursor_colorvariants = ""
184
198
199
+ self .plank_theme = False
200
+ self .plankthemename = ""
201
+ self .plank_darkmode_suffix = "Dark"
202
+ self .plank_colvariants = []
203
+ self .plank_colorvariants = ""
204
+ self .plank_theme_name_style = 0
205
+
185
206
self .theme_interval_HH = 1
186
207
self .theme_interval_MM = 0
187
208
self .theme_interval_SS = 0
@@ -206,6 +227,11 @@ def save_config(self):
206
227
'cursor-theme' : False ,
207
228
'cursor-theme-name' : "" ,
208
229
'cursor-color-variants' : "" ,
230
+ 'plank-theme' : False ,
231
+ 'plank-theme-name' : "" ,
232
+ 'plank-color-variants' : "" ,
233
+ 'plank-dark-mode-suffix' : "Dark" ,
234
+ 'plank-theme-style-name' : 0 ,
209
235
'theme-interval' : '1:0:0'
210
236
}
211
237
with open (CONFIG_FILE , 'w' ) as f :
@@ -239,6 +265,9 @@ def prep_theme_variants(self, state, theme_styles):
239
265
if self .cursor_theme :
240
266
cursrtheme = self .prep_cursor_theme (currentcolor )
241
267
268
+ if self .plank_theme :
269
+ planktheme = self .prep_plank_theme (currentstate , currentcolor )
270
+
242
271
if currentstate == "daytime" :
243
272
wmtheme = self .systemthemename
244
273
if len (currentcolor ) != 0 :
@@ -280,13 +309,14 @@ def prep_theme_variants(self, state, theme_styles):
280
309
else :
281
310
gtktheme = self .systemthemename + "-" + self .darkmode_suffix
282
311
283
- nxt_theme = [timestamp , currentcolor , stateflag , shelltheme , gtktheme , wmtheme , icontheme , cursrtheme ]
312
+ nxt_theme = [timestamp , currentcolor , stateflag , shelltheme , gtktheme , wmtheme , icontheme , cursrtheme , planktheme ]
284
313
themes = {}
285
314
themes ["System" ] = gtktheme
286
315
themes ["DE Theme" ] = shelltheme
287
316
themes ["Decoration" ] = wmtheme
288
317
themes ["Icon" ] = icontheme
289
318
themes ["Cursor" ] = cursrtheme
319
+ themes ["Plank" ] = planktheme
290
320
module_logger .debug ("Next Colour Variant: %s, Next Themes: %s" % (nxt_theme [1 ], themes ))
291
321
292
322
return nxt_theme
@@ -340,6 +370,32 @@ def prep_cursor_theme(self, currentcolor):
340
370
341
371
module_logger .debug ("Cursor Theme: %s, Colour Variant: %s" % (cursrtheme , cursrcolor ))
342
372
return cursrtheme
373
+
374
+ def prep_plank_theme (self , currentstate , currentcolor ):
375
+ for color in self .plank_colvariants :
376
+ if currentcolor .lower () in color .lower ():
377
+ plankcolor = color
378
+ break
379
+ else :
380
+ plankcolor = random .choice (self .plank_colvariants )
381
+ module_logger .debug ("Plank Colour Variant: %s" , plankcolor )
382
+ if currentstate == "night" :
383
+ if len (plankcolor ) != 0 :
384
+ if theme_styles [self .plank_theme_name_style ] == theme_styles [0 ]:
385
+ planktheme = self .plankthemename + "-" + self .plank_darkmode_suffix + "-" + plankcolor
386
+ else :
387
+ planktheme = self .plankthemename + "-" + plankcolor + "-" + self .plank_darkmode_suffix
388
+ else :
389
+ planktheme = self .plankthemename + "-" + self .plank_darkmode_suffix
390
+ else :
391
+ # for daytime and transition
392
+ if len (plankcolor ) != 0 :
393
+ planktheme = self .plankthemename + "-" + plankcolor
394
+ else :
395
+ planktheme = self .plankthemename
396
+
397
+ module_logger .debug ("Plank Theme: %s, Colour Variant: %s" % (planktheme , plankcolor ))
398
+ return planktheme
343
399
344
400
if __name__ == "__main__" :
345
401
pass
0 commit comments