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:
@@ -36,7 +36,9 @@
|
||||
"hide-mode-description": "Controls how the widget behaves when no window is active.",
|
||||
"scrolling-mode-description": "Control when text scrolling is enabled for long window titles.",
|
||||
"show-app-icon-description": "Display the application icon next to the window title.",
|
||||
"show-app-icon-label": "Show app icon"
|
||||
"show-app-icon-label": "Show app icon",
|
||||
"show-app-text-description": "Display the window title.",
|
||||
"show-app-text-label": "Show window title"
|
||||
},
|
||||
"audio-visualizer": {
|
||||
"color-name-description": "Select the color for the visualizer.",
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"bar": {
|
||||
"ActiveWindow": {
|
||||
"showIcon": true,
|
||||
"showText": true,
|
||||
"hideMode": "hidden",
|
||||
"scrollingMode": "hover",
|
||||
"maxWidth": 145,
|
||||
@@ -77,7 +78,7 @@
|
||||
"maxTextLength": {
|
||||
"horizontal": 10,
|
||||
"vertical": 10
|
||||
},
|
||||
},"showIcon": true,
|
||||
"enableColorization": false,
|
||||
"colorizeSystemIcon": "none",
|
||||
"ipcIdentifier": ""
|
||||
@@ -291,4 +292,4 @@
|
||||
"colorName": "primary"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -79,6 +79,7 @@ Singleton {
|
||||
|
||||
property var widgetMetadata: ({
|
||||
"ActiveWindow": {
|
||||
"showText": true,
|
||||
"showIcon": true,
|
||||
"hideMode": "hidden",
|
||||
"scrollingMode": "hover",
|
||||
|
||||
Reference in New Issue
Block a user