mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Merge pull request #2363 from MrDowntempo/main
Feat: Option to hide title in active window bar widget
This commit is contained in:
@@ -40,6 +40,7 @@ Item {
|
||||
|
||||
// Widget settings - matching MediaMini pattern
|
||||
readonly property bool showIcon: (widgetSettings.showIcon !== undefined) ? widgetSettings.showIcon : (widgetMetadata.showIcon || false)
|
||||
readonly property bool showText: (widgetSettings.showText !== undefined) ? widgetSettings.showText : (widgetMetadata.showText || false)
|
||||
readonly property string hideMode: (widgetSettings.hideMode !== undefined) ? widgetSettings.hideMode : (widgetMetadata.hideMode || "hidden")
|
||||
readonly property string scrollingMode: (widgetSettings.scrollingMode !== undefined) ? widgetSettings.scrollingMode : (widgetMetadata.scrollingMode || "hover")
|
||||
|
||||
@@ -98,14 +99,17 @@ Item {
|
||||
// Icon width (if visible)
|
||||
if (showIcon) {
|
||||
contentWidth += iconSize;
|
||||
contentWidth += Style.marginS; // Spacing after icon
|
||||
if (showText) {
|
||||
contentWidth += Style.marginS; // Spacing after icon
|
||||
}
|
||||
}
|
||||
|
||||
// Text width (use the measured width)
|
||||
contentWidth += titleContainer.measuredWidth;
|
||||
|
||||
// Additional small margin for text
|
||||
contentWidth += Style.margin2XXS;
|
||||
if (showText) {
|
||||
contentWidth += titleContainer.measuredWidth;
|
||||
// Additional small margin for text
|
||||
contentWidth += Style.margin2XXS;
|
||||
}
|
||||
|
||||
// Add container margins
|
||||
contentWidth += margins;
|
||||
@@ -257,6 +261,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.preferredHeight: root.capsuleHeight
|
||||
fadeRoundLeftCorners: !showIcon
|
||||
visible: showText
|
||||
|
||||
maxWidth: {
|
||||
// Calculate available width based on other elements
|
||||
|
||||
@@ -17,6 +17,7 @@ ColumnLayout {
|
||||
|
||||
// Local state
|
||||
property bool valueShowIcon: widgetData.showIcon !== undefined ? widgetData.showIcon : widgetMetadata.showIcon
|
||||
property bool valueShowText: widgetData.showText !== undefined ? widgetData.showText : widgetMetadata.showText
|
||||
property string valueHideMode: widgetData.hideMode !== undefined ? widgetData.hideMode : widgetMetadata.hideMode
|
||||
property string valueScrollingMode: widgetData.scrollingMode || widgetMetadata.scrollingMode
|
||||
property int valueMaxWidth: widgetData.maxWidth !== undefined ? widgetData.maxWidth : widgetMetadata.maxWidth
|
||||
@@ -34,6 +35,7 @@ ColumnLayout {
|
||||
var settings = Object.assign({}, widgetData || {});
|
||||
settings.hideMode = valueHideMode;
|
||||
settings.showIcon = valueShowIcon;
|
||||
settings.showText = valueShowText;
|
||||
settings.scrollingMode = valueScrollingMode;
|
||||
settings.maxWidth = parseInt(widthInput.text) || widgetMetadata.maxWidth;
|
||||
settings.useFixedWidth = valueUseFixedWidth;
|
||||
@@ -78,6 +80,18 @@ ColumnLayout {
|
||||
defaultValue: widgetMetadata.textColor
|
||||
}
|
||||
|
||||
NToggle {
|
||||
Layout.fillWidth: true
|
||||
label: I18n.tr("bar.active-window.show-app-text-label")
|
||||
description: I18n.tr("bar.active-window.show-app-text-description")
|
||||
checked: root.valueShowText
|
||||
onToggled: checked => {
|
||||
root.valueShowText = checked;
|
||||
saveSettings();
|
||||
}
|
||||
defaultValue: widgetMetadata.showText
|
||||
}
|
||||
|
||||
NToggle {
|
||||
Layout.fillWidth: true
|
||||
label: I18n.tr("bar.active-window.show-app-icon-label")
|
||||
|
||||
Reference in New Issue
Block a user