ActiveWindow: implement dynamic width with max width setting

This commit is contained in:
Sakari
2025-10-17 15:11:53 +08:00
parent d56c197fd3
commit a12fbca80b
9 changed files with 70 additions and 28 deletions
@@ -17,7 +17,7 @@ ColumnLayout {
property bool valueShowIcon: widgetData.showIcon !== undefined ? widgetData.showIcon : widgetMetadata.showIcon
property string valueHideMode: "hidden" // Default to 'Hide When Empty'
property string valueScrollingMode: widgetData.scrollingMode || widgetMetadata.scrollingMode
property int valueWidth: widgetData.width !== undefined ? widgetData.width : widgetMetadata.width
property int valueMaxWidth: widgetData.maxWidth !== undefined ? widgetData.maxWidth : widgetMetadata.maxWidth
property bool valueColorizeIcons: widgetData.colorizeIcons !== undefined ? widgetData.colorizeIcons : widgetMetadata.colorizeIcons
Component.onCompleted: {
@@ -31,7 +31,7 @@ ColumnLayout {
settings.hideMode = valueHideMode
settings.showIcon = valueShowIcon
settings.scrollingMode = valueScrollingMode
settings.width = parseInt(widthInput.text) || widgetMetadata.width
settings.maxWidth = parseInt(widthInput.text) || widgetMetadata.maxWidth
settings.colorizeIcons = valueColorizeIcons
return settings
}
@@ -73,10 +73,10 @@ ColumnLayout {
NTextInput {
id: widthInput
Layout.fillWidth: true
label: I18n.tr("bar.widget-settings.active-window.width.label")
description: I18n.tr("bar.widget-settings.active-window.width.description")
placeholderText: widgetMetadata.width
text: valueWidth
label: I18n.tr("bar.widget-settings.active-window.max-width.label")
description: I18n.tr("bar.widget-settings.active-window.max-width.description")
placeholderText: widgetMetadata.maxWidth
text: valueMaxWidth
}
NComboBox {