@@ -228,7 +228,7 @@ PlasmoidItem {
228
228
return newColor
229
229
}
230
230
231
- function applyFgColor (element , newColor , fgColorCfg , depth , wRecolorCfg ) {
231
+ function applyFgColor (element , newColor , fgColorCfg , depth , wRecolorCfg , fgColorModified ) {
232
232
let count = 0 ;
233
233
let maxDepth = depth
234
234
const forceMask = wRecolorCfg? .method ? .mask ?? false
@@ -238,7 +238,11 @@ PlasmoidItem {
238
238
var child = element .visibleChildren [i]
239
239
let targetTypes = [Text ,ToolButton,Label,Canvas,Kirigami .Icon ]
240
240
if (targetTypes .some (function (type ) {return child instanceof type})) {
241
- if (child .color ) {
241
+ // before trying to apply the foreground color, we need to know if we
242
+ // have changed it in the first place, otherwise we have no easy way to
243
+ // restore the original binding for widgets that do dynamic color
244
+ // requires restarting plasma but is better than nothing
245
+ if ((fgColorCfg .enabled || fgColorModified) && child .color ) {
242
246
child .color = newColor
243
247
}
244
248
if (child .Kirigami ? .Theme ) {
@@ -267,7 +271,7 @@ PlasmoidItem {
267
271
// repaintDebugComponent.createObject(child)
268
272
}
269
273
if (child .visibleChildren ? .length ?? 0 > 0 ) {
270
- const result = applyFgColor (child, newColor, fgColorCfg, depth + 1 , wRecolorCfg)
274
+ const result = applyFgColor (child, newColor, fgColorCfg, depth + 1 , wRecolorCfg, fgColorModified )
271
275
count += result .count
272
276
if (result .depth > maxDepth) {
273
277
maxDepth = result .depth
@@ -368,9 +372,9 @@ PlasmoidItem {
368
372
property int maxDepth: 0
369
373
visible: cfgEnabled
370
374
property bool cfgEnabled: cfg .enabled && isEnabled
371
- property bool bgEnabled: cfgEnabled ? bgColorCfg .enabled : false
372
- property bool fgEnabled: fgColorCfg . enabled && cfgEnabled
373
- property bool radiusEnabled: cfg .radius .enabled && cfgEnabled
375
+ property bool bgEnabled: cfgEnabled && bgColorCfg .enabled
376
+ property bool fgEnabled: cfgEnabled && fgColorCfg . enabled
377
+ property bool radiusEnabled: cfgEnabled && cfg .radius .enabled
374
378
property int topLeftRadius: ! radiusEnabled || unifyBgType === 2 || unifyBgType === 3
375
379
? 0
376
380
: cfg .radius .corner .topLeft ?? 0
@@ -407,7 +411,7 @@ PlasmoidItem {
407
411
}
408
412
property string fgColor: {
409
413
if (! fgEnabled && ! inTray) {
410
- return Kirigami .Theme .textColor
414
+ return main . Kirigami .Theme .textColor
411
415
} else if ((! fgEnabled && inTray && widgetEnabled)) {
412
416
// inherit tray widget fg color to tray icons
413
417
return trayWidgetBgItem .fgColor
@@ -428,7 +432,6 @@ PlasmoidItem {
428
432
width: height
429
433
visible: false
430
434
radius: height / 2
431
- color: fgColor
432
435
anchors .right : parent .right
433
436
Kirigami .Theme .colorSet : Kirigami .Theme [fgColorCfg .systemColorSet ]
434
437
}
@@ -438,7 +441,6 @@ PlasmoidItem {
438
441
width: height
439
442
visible: false
440
443
radius: height / 2
441
- color: fgColor
442
444
anchors .right : parent .right
443
445
Kirigami .Theme .colorSet : Kirigami .Theme [bgColorCfg .systemColorSet ]
444
446
}
@@ -483,14 +485,19 @@ PlasmoidItem {
483
485
recolorTimer .restart ()
484
486
}
485
487
488
+ property bool fgColorModified: false
489
+
490
+ onFgEnabledChanged: {
491
+ if (fgEnabled) fgColorModified = true
492
+ }
493
+
486
494
Timer {
487
495
id: recolorTimer
488
496
interval: 10
489
497
onTriggered: {
490
498
if (isPanel) return
491
- if (! fgEnabled) return
492
499
if (widgetName === " org.kde.plasma.systemtray" && separateTray) return
493
- const result = applyFgColor (target, fgColor, fgColorCfg, 0 , wRecolorCfg)
500
+ const result = applyFgColor (target, fgColor, fgColorCfg, 0 , wRecolorCfg, fgColorModified )
494
501
if (result) {
495
502
itemCount = result .count
496
503
maxDepth = result .depth
0 commit comments