Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions Modules/Bar/Widgets/Taskbar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,21 @@ Rectangle {
}

readonly property int titleWidth: {
if (smartWidth && showTitle && !isVerticalBar && combinedModel.length > 0) {
var entriesCount = combinedModel.length;
var baseWidth = 140;
var calculatedWidth = baseWidth / Math.sqrt(entriesCount);
// First, use user-defined title width if set
var calculatedWidth = (widgetSettings.titleWidth !== undefined) ? widgetSettings.titleWidth : widgetMetadata.titleWidth;

// Second, shrink title width if it exceeds maxTaskbarWidth when smartWidth is enabled
if (smartWidth && combinedModel.length > 0) {
if (maxTaskbarWidth > 0) {
var entriesCount = combinedModel.length;
var maxWidthPerEntry = (maxTaskbarWidth / entriesCount) - itemSize - Style.marginS - Style.marginM * 2;
calculatedWidth = Math.min(calculatedWidth, maxWidthPerEntry);
}

return Math.max(Math.round(calculatedWidth), 20);
calculatedWidth = Math.max(Math.round(calculatedWidth), 20);
}
return (widgetSettings.titleWidth !== undefined) ? widgetSettings.titleWidth : widgetMetadata.titleWidth;

return calculatedWidth;
}
readonly property bool showPinnedApps: (widgetSettings.showPinnedApps !== undefined) ? widgetSettings.showPinnedApps : widgetMetadata.showPinnedApps

Expand Down
20 changes: 10 additions & 10 deletions Modules/Panels/Settings/Bar/WidgetSettings/TaskbarSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,16 @@ ColumnLayout {
enabled: !isVerticalBar
}

NTextInput {
id: titleWidthInput
visible: root.valueShowTitle && !isVerticalBar
Layout.fillWidth: true
label: I18n.tr("bar.widget-settings.taskbar.title-width.label")
description: I18n.tr("bar.widget-settings.taskbar.title-width.description")
text: widgetData.titleWidth || widgetMetadata.titleWidth
placeholderText: I18n.tr("placeholders.enter-width-pixels")
}

NToggle {
Layout.fillWidth: true
visible: !isVerticalBar && root.valueShowTitle
Expand Down Expand Up @@ -161,14 +171,4 @@ ColumnLayout {
text: Math.round(root.valueMaxTaskbarWidth) + "%"
}
}

NTextInput {
id: titleWidthInput
visible: root.valueShowTitle && !isVerticalBar && !root.valueSmartWidth
Layout.fillWidth: true
label: I18n.tr("bar.widget-settings.taskbar.title-width.label")
description: I18n.tr("bar.widget-settings.taskbar.title-width.description")
text: widgetData.titleWidth || widgetMetadata.titleWidth
placeholderText: I18n.tr("placeholders.enter-width-pixels")
}
}