@@ -12,6 +12,27 @@ import qs.Widgets
1212Item {
1313 id: root
1414
15+ NPopupContextMenu {
16+ id: contextMenu
17+
18+ model: [
19+ {
20+ " label" : I18n .tr (" actions.widget-settings" ),
21+ " action" : " widget-settings" ,
22+ " icon" : " settings"
23+ },
24+ ]
25+
26+ onTriggered : action => {
27+ contextMenu .close ();
28+ PanelService .closeContextMenu (screen );
29+
30+ if (action === " widget-settings" ) {
31+ BarService .openWidgetSettings (screen , section, sectionWidgetIndex, widgetId, widgetSettings);
32+ }
33+ }
34+ }
35+
1536 property ShellScreen screen
1637
1738 // Widget properties passed from Bar.qml for per-instance settings
3758 readonly property bool isVerticalBar: barPosition === " left" || barPosition === " right"
3859
3960 readonly property string customIcon: widgetSettings .icon || widgetMetadata .icon
61+ readonly property string iconPosition: widgetSettings .iconPosition || widgetMetadata .iconPosition
4062 readonly property string leftClickExec: widgetSettings .leftClickExec || widgetMetadata .leftClickExec
4163 readonly property bool leftClickUpdateText: widgetSettings .leftClickUpdateText ?? widgetMetadata .leftClickUpdateText
4264 readonly property string rightClickExec: widgetSettings .rightClickExec || widgetMetadata .rightClickExec
@@ -139,14 +161,19 @@ Item {
139161 return " " .repeat (currentMaxTextLength);
140162 }
141163
142- readonly property bool enableColorization: widgetSettings .enableColorization || false
143164 readonly property string colorizeSystemIcon: {
144165 if (widgetSettings .colorizeSystemIcon !== undefined )
145166 return widgetSettings .colorizeSystemIcon ;
146167 return widgetMetadata .colorizeSystemIcon !== undefined ? widgetMetadata .colorizeSystemIcon : " none" ;
147168 }
169+ readonly property string colorizeSystemText: {
170+ if (widgetSettings .colorizeSystemText !== undefined )
171+ return widgetSettings .colorizeSystemText ;
172+ return widgetMetadata .colorizeSystemText !== undefined ? widgetMetadata .colorizeSystemText : " none" ;
173+ }
148174
149- readonly property bool isColorizing: enableColorization && colorizeSystemIcon !== " none"
175+ // Colorization is active if either icon or text has a color set
176+ readonly property bool isColorizing: colorizeSystemIcon !== " none" || colorizeSystemText !== " none"
150177
151178 // Get color value from color name (returns null for invalid names)
152179 function _getColorValue (colorName , forHover ) {
@@ -187,8 +214,10 @@ Item {
187214 return isHover ? Color .mOnHover : Color .mOnSurface ;
188215 }
189216
190- readonly property color iconColor: _resolveIconColor (_dynamicColor, colorizeSystemIcon, false )
191- readonly property color iconHoverColor: _resolveIconColor (_dynamicColor, colorizeSystemIcon, true )
217+ readonly property color iconColor: _resolveIconColor (_dynamicIconColor || _dynamicColor, colorizeSystemIcon, false )
218+ readonly property color iconHoverColor: _resolveIconColor (_dynamicIconColor || _dynamicColor, colorizeSystemIcon, true )
219+ readonly property color textColor: _resolveIconColor (_dynamicTextColor || _dynamicColor, colorizeSystemText, false )
220+ readonly property color textHoverColor: _resolveIconColor (_dynamicTextColor || _dynamicColor, colorizeSystemText, true )
192221
193222 implicitWidth: pill .width
194223 implicitHeight: pill .height
@@ -200,13 +229,15 @@ Item {
200229 opacity: _pillOpacity
201230 screen : root .screen
202231 oppositeDirection: BarService .getPillDirection (root)
232+ iconPosition: root .iconPosition
203233 icon: _pillIcon
204234 text: _pillText
205235 rotateText: isVerticalBar && currentMaxTextLength > 0
206236 autoHide: false
207237 forceOpen: _pillForceOpen
208238 forceClose: ! _pillForceOpen
209- customTextIconColor: iconColor
239+ customIconColor: iconColor
240+ customTextColor: textColor
210241
211242 // Helper function to build tooltip content
212243 function _buildTooltipContent () {
@@ -285,6 +316,8 @@ Item {
285316 property string _dynamicIcon: " "
286317 property string _dynamicTooltip: " "
287318 property string _dynamicColor: " "
319+ property string _dynamicIconColor: " "
320+ property string _dynamicTextColor: " "
288321
289322 // Maximum length for text display before scrolling (different values for horizontal and vertical)
290323 readonly property var maxTextLength: {
@@ -413,18 +446,34 @@ Item {
413446 const text = parsed .text || " " ;
414447 const icon = parsed .icon || " " ;
415448 let tooltip = parsed .tooltip || " " ;
416- const color = parsed .color || " " ;
417449
418- // Validate color value
450+ // Support both "color" (legacy) and "iconColor"/"textColor" (new)
451+ const legacyColor = parsed .color || " " ;
452+ const iconColorKey = parsed .iconColor || " " ;
453+ const textColorKey = parsed .textColor || " " ;
454+
419455 const validColors = [" primary" , " secondary" , " tertiary" , " error" , " none" ];
420- const validColor = (color && validColors .includes (color)) ? color : " " ;
456+
457+ // Helper to resolve color: legacy > specific > none
458+ function resolveColor (legacy , specific ) {
459+ if (legacy && validColors .includes (legacy))
460+ return legacy;
461+ if (specific && validColors .includes (specific))
462+ return specific;
463+ return " " ;
464+ }
465+
466+ const resolvedIconColor = resolveColor (legacyColor, iconColorKey);
467+ const resolvedTextColor = resolveColor (legacyColor, textColorKey);
421468
422469 if (checkCollapse (text)) {
423470 _scrollState .originalText = " " ;
424471 _dynamicText = " " ;
425472 _dynamicIcon = " " ;
426473 _dynamicTooltip = " " ;
427474 _dynamicColor = " " ;
475+ _dynamicIconColor = " " ;
476+ _dynamicTextColor = " " ;
428477 _scrollState .needsScrolling = false ;
429478 _scrollState .phase = 0 ;
430479 _scrollState .phaseCounter = 0 ;
@@ -444,7 +493,9 @@ Item {
444493 scrollTimer .stop ();
445494 }
446495 _dynamicIcon = icon;
447- _dynamicColor = validColor;
496+ _dynamicColor = legacyColor; // Keep legacy color for fallback
497+ _dynamicIconColor = resolvedIconColor;
498+ _dynamicTextColor = resolvedTextColor;
448499
449500 _dynamicTooltip = toHtml (tooltip);
450501 _scrollState .offset = 0 ;
@@ -460,6 +511,8 @@ Item {
460511 _dynamicIcon = " " ;
461512 _dynamicTooltip = " " ;
462513 _dynamicColor = " " ;
514+ _dynamicIconColor = " " ;
515+ _dynamicTextColor = " " ;
463516 _scrollState .needsScrolling = false ;
464517 _scrollState .phase = 0 ;
465518 _scrollState .phaseCounter = 0 ;
@@ -480,6 +533,8 @@ Item {
480533 }
481534 _dynamicIcon = " " ;
482535 _dynamicColor = " " ;
536+ _dynamicIconColor = " " ;
537+ _dynamicTextColor = " " ;
483538 _dynamicTooltip = toHtml (contentStr);
484539 _scrollState .offset = 0 ;
485540 }
@@ -521,8 +576,8 @@ Item {
521576 if (rightClickExec) {
522577 Quickshell .execDetached ([" sh" , " -lc" , rightClickExec]);
523578 Logger .i (" CustomButton" , ` Executing command: ${ rightClickExec} ` );
524- } else if ( ! rightClickUpdateText) {
525- BarService . openWidgetSettings ( screen , section, sectionWidgetIndex, widgetId, widgetSettings );
579+ } else {
580+ PanelService . showContextMenu (contextMenu, pill, screen );
526581 }
527582 if (! textStream && rightClickUpdateText) {
528583 runTextCommand ();
0 commit comments