refactor(bar): remove enableColorization toggle from CustomButton

Colorization now activates automatically when icon or text color is set,
simplifying the UX by removing an extra toggle step.
This commit is contained in:
loner
2026-04-06 08:40:02 +08:00
parent f21e8fb82a
commit 5c3b3a2185
5 changed files with 4 additions and 22 deletions
-2
View File
@@ -112,8 +112,6 @@
"display-command-output-label": "Display command output",
"display-command-output-stream-description": "Enter a command to run continuously.",
"dynamic-text": "Dynamic text",
"enable-colorization-description": "Enable colorization for the custom button icon and text, applying theme colors.",
"enable-colorization-label": "Enable colorization",
"general-tooltip-text-description": "Custom text to display in the button's tooltip.",
"general-tooltip-text-label": "Custom tooltip text",
"hide-mode-always-expanded": "Always expanded",
+1 -1
View File
@@ -80,8 +80,8 @@
"horizontal": 10,
"vertical": 10
},
"enableColorization": false,
"colorizeSystemIcon": "none",
"colorizeSystemText": "none",
"ipcIdentifier": ""
},
"DarkMode": {
+2 -2
View File
@@ -140,7 +140,6 @@ Item {
return " ".repeat(currentMaxTextLength);
}
readonly property bool enableColorization: widgetSettings.enableColorization || false
readonly property string colorizeSystemIcon: {
if (widgetSettings.colorizeSystemIcon !== undefined)
return widgetSettings.colorizeSystemIcon;
@@ -152,7 +151,8 @@ Item {
return widgetMetadata.colorizeSystemText !== undefined ? widgetMetadata.colorizeSystemText : "none";
}
readonly property bool isColorizing: enableColorization && (colorizeSystemIcon !== "none" || colorizeSystemText !== "none")
// Colorization is active if either icon or text has a color set
readonly property bool isColorizing: colorizeSystemIcon !== "none" || colorizeSystemText !== "none"
// Get color value from color name (returns null for invalid names)
function _getColorValue(colorName, forHover) {
@@ -30,7 +30,6 @@ ColumnLayout {
property bool valueShowIcon: (widgetData.showIcon !== undefined) ? widgetData.showIcon : widgetMetadata.showIcon
property bool valueShowExecTooltip: widgetData.showExecTooltip !== undefined ? widgetData.showExecTooltip : widgetMetadata.showExecTooltip
property bool valueShowTextTooltip: widgetData.showTextTooltip !== undefined ? widgetData.showTextTooltip : widgetMetadata.showTextTooltip
property bool valueEnableColorization: widgetData.enableColorization !== undefined ? widgetData.enableColorization : widgetMetadata.enableColorization
property string valueColorizeSystemIcon: widgetData.colorizeSystemIcon !== undefined ? widgetData.colorizeSystemIcon : widgetMetadata.colorizeSystemIcon
property string valueColorizeSystemText: widgetData.colorizeSystemText !== undefined ? widgetData.colorizeSystemText : widgetMetadata.colorizeSystemText
property string valueIpcIdentifier: widgetData.ipcIdentifier !== undefined ? widgetData.ipcIdentifier : widgetMetadata.ipcIdentifier
@@ -66,7 +65,6 @@ ColumnLayout {
"vertical": valueMaxTextLengthVertical
};
settings.textIntervalMs = parseInt(textIntervalInput.text || textIntervalInput.placeholderText, 10);
settings.enableColorization = valueEnableColorization;
settings.colorizeSystemIcon = valueColorizeSystemIcon;
settings.colorizeSystemText = valueColorizeSystemText;
settings.ipcIdentifier = valueIpcIdentifier;
@@ -150,19 +148,7 @@ ColumnLayout {
defaultValue: widgetMetadata.iconPosition
}
NToggle {
label: I18n.tr("bar.custom-button.enable-colorization-label")
description: I18n.tr("bar.custom-button.enable-colorization-description")
checked: valueEnableColorization
onToggled: checked => {
valueEnableColorization = checked;
saveSettings();
}
defaultValue: widgetMetadata.enableColorization
}
NColorChoice {
visible: valueEnableColorization
label: I18n.tr("common.select-icon-color")
description: I18n.tr("bar.custom-button.icon-color-selection-description")
currentKey: valueColorizeSystemIcon
@@ -174,7 +160,6 @@ ColumnLayout {
}
NColorChoice {
visible: valueEnableColorization
label: I18n.tr("common.select-text-color")
description: I18n.tr("bar.custom-button.text-color-selection-description")
currentKey: valueColorizeSystemText
+1 -2
View File
@@ -159,9 +159,8 @@ Singleton {
"horizontal": 10,
"vertical": 10
},
"enableColorization": false,
"colorizeSystemIcon": "none",
"colorizeSystemText": "none",
"colorizeSystemText": "none",
"ipcIdentifier": ""
},
"DarkMode": {