ActiveWindow: new setting to set your favorite width. Fix #417

This commit is contained in:
ItsLemmy
2025-10-04 14:33:04 -04:00
parent 502f3da4e8
commit bc14ab95f9
9 changed files with 38 additions and 3 deletions
+1 -2
View File
@@ -41,9 +41,8 @@ Item {
readonly property bool showIcon: (widgetSettings.showIcon !== undefined) ? widgetSettings.showIcon : widgetMetadata.showIcon
readonly property bool autoHide: (widgetSettings.autoHide !== undefined) ? widgetSettings.autoHide : widgetMetadata.autoHide
readonly property string scrollingMode: (widgetSettings.scrollingMode !== undefined) ? widgetSettings.scrollingMode : (widgetMetadata.scrollingMode !== undefined ? widgetMetadata.scrollingMode : "hover")
readonly property int widgetWidth: (widgetSettings.width !== undefined) ? widgetSettings.width : Math.max(widgetMetadata.width, screen.width * 0.06)
// Fixed width
readonly property real widgetWidth: Math.max(145, screen.width * 0.06)
implicitHeight: visible ? ((barPosition === "left" || barPosition === "right") ? calculatedVerticalHeight() : Math.round(Style.barHeight * scaling)) : 0
implicitWidth: visible ? ((barPosition === "left" || barPosition === "right") ? Math.round(Style.baseWidgetSize * 0.8 * scaling) : (widgetWidth * scaling)) : 0
@@ -17,12 +17,14 @@ ColumnLayout {
property bool valueShowIcon: widgetData.showIcon !== undefined ? widgetData.showIcon : widgetMetadata.showIcon
property bool valueAutoHide: widgetData.autoHide !== undefined ? widgetData.autoHide : widgetMetadata.autoHide
property string valueScrollingMode: widgetData.scrollingMode || widgetMetadata.scrollingMode
property int valueWidth: widgetData.width !== undefined ? widgetData.width : widgetMetadata.width
function saveSettings() {
var settings = Object.assign({}, widgetData || {})
settings.autoHide = valueAutoHide
settings.showIcon = valueShowIcon
settings.scrollingMode = valueScrollingMode
settings.width = parseInt(widthInput.text) || widgetMetadata.width
return settings
}
@@ -42,6 +44,15 @@ ColumnLayout {
onToggled: checked => root.valueShowIcon = checked
}
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
}
NComboBox {
label: I18n.tr("bar.widget-settings.active-window.scrolling-mode.label")
description: I18n.tr("bar.widget-settings.active-window.scrolling-mode.description")