mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user