From 84e394e0f3ceff5aad9707d6f6afd186c34f799a Mon Sep 17 00:00:00 2001 From: Lemmy Date: Fri, 6 Feb 2026 11:53:51 -0500 Subject: [PATCH] activewindow-mediamini: support for colored text --- Modules/Bar/Widgets/ActiveWindow.qml | 4 +++- Modules/Bar/Widgets/MediaMini.qml | 5 +++-- .../Bar/WidgetSettings/ActiveWindowSettings.qml | 15 +++++++++++++++ .../Bar/WidgetSettings/MediaMiniSettings.qml | 14 ++++++++++++++ Services/UI/BarWidgetRegistry.qml | 4 +++- 5 files changed, 38 insertions(+), 4 deletions(-) diff --git a/Modules/Bar/Widgets/ActiveWindow.qml b/Modules/Bar/Widgets/ActiveWindow.qml index 4017d655d..28a897246 100644 --- a/Modules/Bar/Widgets/ActiveWindow.qml +++ b/Modules/Bar/Widgets/ActiveWindow.qml @@ -46,6 +46,8 @@ Item { // Maximum widget width with user settings support readonly property real maxWidth: (widgetSettings.maxWidth !== undefined) ? widgetSettings.maxWidth : Math.max(widgetMetadata.maxWidth || 0, screen ? screen.width * 0.06 : 0) readonly property bool useFixedWidth: (widgetSettings.useFixedWidth !== undefined) ? widgetSettings.useFixedWidth : (widgetMetadata.useFixedWidth || false) + readonly property string textColorKey: (widgetSettings.textColor !== undefined) ? widgetSettings.textColor : widgetMetadata.textColor + readonly property color textColor: Color.resolveColorKey(textColorKey) readonly property string barPosition: Settings.getBarPositionForScreen(screenName) readonly property bool isVerticalBar: barPosition === "left" || barPosition === "right" @@ -274,7 +276,7 @@ Item { pointSize: barFontSize applyUiScale: false font.weight: Style.fontWeightMedium - color: Color.mOnSurface + color: root.textColor } } } diff --git a/Modules/Bar/Widgets/MediaMini.qml b/Modules/Bar/Widgets/MediaMini.qml index cb3a3000f..656341203 100644 --- a/Modules/Bar/Widgets/MediaMini.qml +++ b/Modules/Bar/Widgets/MediaMini.qml @@ -53,6 +53,8 @@ Item { readonly property bool showProgressRing: (widgetSettings.showProgressRing !== undefined) ? widgetSettings.showProgressRing : widgetMetadata.showProgressRing readonly property bool useFixedWidth: (widgetSettings.useFixedWidth !== undefined) ? widgetSettings.useFixedWidth : widgetMetadata.useFixedWidth readonly property real maxWidth: (widgetSettings.maxWidth !== undefined) ? widgetSettings.maxWidth : Math.max(widgetMetadata.maxWidth, screen ? screen.width * 0.06 : 0) + readonly property string textColorKey: (widgetSettings.textColor !== undefined) ? widgetSettings.textColor : widgetMetadata.textColor + readonly property color textColor: Color.resolveColorKey(textColorKey) // Dimensions readonly property int artSize: Style.toOdd(capsuleHeight * 0.75) @@ -336,8 +338,7 @@ Item { maxWidth: root.maxWidth - root.mainContentWidth forcedHover: mainMouseArea.containsMouse NText { - // anchors.fill: parent - color: hasPlayer ? Color.mOnSurface : Color.mOnSurfaceVariant + color: hasPlayer ? root.textColor : Color.mOnSurfaceVariant pointSize: barFontSize } } diff --git a/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml b/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml index f5481258d..9f0348d44 100644 --- a/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml +++ b/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml @@ -21,6 +21,7 @@ ColumnLayout { property int valueMaxWidth: widgetData.maxWidth !== undefined ? widgetData.maxWidth : widgetMetadata.maxWidth property bool valueUseFixedWidth: widgetData.useFixedWidth !== undefined ? widgetData.useFixedWidth : widgetMetadata.useFixedWidth property bool valueColorizeIcons: widgetData.colorizeIcons !== undefined ? widgetData.colorizeIcons : widgetMetadata.colorizeIcons + property string valueTextColor: widgetData.textColor !== undefined ? widgetData.textColor : widgetMetadata.textColor Component.onCompleted: { if (widgetData && widgetData.hideMode !== undefined) { @@ -36,6 +37,7 @@ ColumnLayout { settings.maxWidth = parseInt(widthInput.text) || widgetMetadata.maxWidth; settings.useFixedWidth = valueUseFixedWidth; settings.colorizeIcons = valueColorizeIcons; + settings.textColor = valueTextColor; return settings; } @@ -64,6 +66,18 @@ ColumnLayout { } } + NComboBox { + label: I18n.tr("common.select-color") + description: I18n.tr("common.select-color-description") + model: Color.colorKeyModel + currentKey: valueTextColor + onSelected: key => { + valueTextColor = key; + settingsChanged(saveSettings()); + } + minimumWidth: 200 + } + NToggle { Layout.fillWidth: true label: I18n.tr("bar.active-window.show-app-icon-label") @@ -84,6 +98,7 @@ ColumnLayout { root.valueColorizeIcons = checked; settingsChanged(saveSettings()); } + visible: root.valueShowIcon } NTextInput { diff --git a/Modules/Panels/Settings/Bar/WidgetSettings/MediaMiniSettings.qml b/Modules/Panels/Settings/Bar/WidgetSettings/MediaMiniSettings.qml index 93d4b7561..216186718 100644 --- a/Modules/Panels/Settings/Bar/WidgetSettings/MediaMiniSettings.qml +++ b/Modules/Panels/Settings/Bar/WidgetSettings/MediaMiniSettings.qml @@ -28,6 +28,7 @@ ColumnLayout { property bool valueUseFixedWidth: (widgetData && widgetData.useFixedWidth !== undefined) ? widgetData.useFixedWidth : (widgetMetadata && widgetMetadata.useFixedWidth !== undefined ? widgetMetadata.useFixedWidth : false) property bool valueShowProgressRing: (widgetData && widgetData.showProgressRing !== undefined) ? widgetData.showProgressRing : (widgetMetadata && widgetMetadata.showProgressRing !== undefined ? widgetMetadata.showProgressRing : true) property bool valueCompactMode: widgetData.compactMode !== undefined ? widgetData.compactMode : widgetMetadata.compactMode + property string valueTextColor: (widgetData && widgetData.textColor !== undefined) ? widgetData.textColor : (widgetMetadata && widgetMetadata.textColor !== undefined ? widgetMetadata.textColor : "none") Component.onCompleted: { if (widgetData && widgetData.hideMode !== undefined) { @@ -49,6 +50,7 @@ ColumnLayout { settings.useFixedWidth = valueUseFixedWidth; settings.showProgressRing = valueShowProgressRing; settings.compactMode = valueCompactMode; + settings.textColor = valueTextColor; return settings; } @@ -167,6 +169,18 @@ ColumnLayout { } } + NComboBox { + label: I18n.tr("common.select-color") + description: I18n.tr("common.select-color-description") + model: Color.colorKeyModel + currentKey: valueTextColor + onSelected: key => { + valueTextColor = key; + settingsChanged(saveSettings()); + } + minimumWidth: 200 + } + NComboBox { label: I18n.tr("bar.media-mini.scrolling-mode-label") description: I18n.tr("bar.media-mini.scrolling-mode-description") diff --git a/Services/UI/BarWidgetRegistry.qml b/Services/UI/BarWidgetRegistry.qml index c22aef3f4..ca7c18d3f 100644 --- a/Services/UI/BarWidgetRegistry.qml +++ b/Services/UI/BarWidgetRegistry.qml @@ -82,7 +82,8 @@ Singleton { "scrollingMode": "hover", "maxWidth": 145, "useFixedWidth": false, - "colorizeIcons": false + "colorizeIcons": false, + "textColor": "none" }, "AudioVisualizer": { "width": 200, @@ -190,6 +191,7 @@ Singleton { "showVisualizer": false, "showProgressRing": true, "visualizerType": "linear", + "textColor": "none", "compactMode": false, "panelShowAlbumArt": true, "panelShowVisualizer": true,