From 53b5dbac4c81d69fc688ef6b95db3a0157840d4f Mon Sep 17 00:00:00 2001 From: Corey Woodworth <8398380+MrDowntempo@users.noreply.github.com> Date: Tue, 31 Mar 2026 02:55:23 -0400 Subject: [PATCH 1/6] feat: Add showText variable to show/hide name of Active Window --- Modules/Bar/Widgets/ActiveWindow.qml | 663 ++++++++++++++------------- 1 file changed, 334 insertions(+), 329 deletions(-) diff --git a/Modules/Bar/Widgets/ActiveWindow.qml b/Modules/Bar/Widgets/ActiveWindow.qml index 14fc1d7b6..c9099bd2b 100644 --- a/Modules/Bar/Widgets/ActiveWindow.qml +++ b/Modules/Bar/Widgets/ActiveWindow.qml @@ -11,370 +11,375 @@ import qs.Services.UI import qs.Widgets Item { - id: root - Layout.preferredHeight: isVerticalBar ? -1 : Style.getBarHeightForScreen(screenName) - Layout.preferredWidth: isVerticalBar ? Style.getBarHeightForScreen(screenName) : -1 - Layout.fillHeight: false - Layout.fillWidth: false + id: root + Layout.preferredHeight: isVerticalBar ? -1 : Style.getBarHeightForScreen(screenName) + Layout.preferredWidth: isVerticalBar ? Style.getBarHeightForScreen(screenName) : -1 + Layout.fillHeight: false + Layout.fillWidth: false - property ShellScreen screen + property ShellScreen screen - // Widget properties passed from Bar.qml for per-instance settings - property string widgetId: "" - property string section: "" - property int sectionWidgetIndex: -1 - property int sectionWidgetsCount: 0 + // Widget properties passed from Bar.qml for per-instance settings + property string widgetId: "" + property string section: "" + property int sectionWidgetIndex: -1 + property int sectionWidgetsCount: 0 - property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] || {} - // Explicit screenName property ensures reactive binding when screen changes - readonly property string screenName: screen ? screen.name : "" - property var widgetSettings: { - if (section && sectionWidgetIndex >= 0 && screenName) { - var widgets = Settings.getBarWidgetsForScreen(screenName)[section]; - if (widgets && sectionWidgetIndex < widgets.length && widgets[sectionWidgetIndex]) { - return widgets[sectionWidgetIndex]; - } - } - return {}; - } - - // Widget settings - matching MediaMini pattern - readonly property bool showIcon: (widgetSettings.showIcon !== undefined) ? widgetSettings.showIcon : (widgetMetadata.showIcon || 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") - - // 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" - readonly property real barHeight: Style.getBarHeightForScreen(screenName) - readonly property real capsuleHeight: Style.getCapsuleHeightForScreen(screenName) - readonly property real barFontSize: Style.getBarFontSizeForScreen(screenName) - readonly property bool hasFocusedWindow: CompositorService.getFocusedWindow() !== null - readonly property string windowTitle: CompositorService.getFocusedWindowTitle() || "No active window" - readonly property string fallbackIcon: "user-desktop" - - readonly property int iconSize: Style.toOdd(capsuleHeight * 0.75) - readonly property int verticalSize: Style.toOdd(capsuleHeight * 0.85) - - // For horizontal bars, height is always barHeight (no animation needed) - // For vertical bars, collapse to 0 when hidden - implicitHeight: isVerticalBar ? (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : verticalSize) : barHeight - implicitWidth: isVerticalBar ? (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : verticalSize) : (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : dynamicWidth) - - // "visible": Always Visible, "hidden": Hide When Empty, "transparent": Transparent When Empty - visible: (hideMode !== "hidden" || hasFocusedWindow) || opacity > 0 - opacity: ((hideMode !== "hidden" || hasFocusedWindow) && (hideMode !== "transparent" || hasFocusedWindow)) ? 1.0 : 0.0 - Behavior on opacity { - NumberAnimation { - duration: Style.animationNormal - easing.type: Easing.OutCubic - } - } - - Behavior on implicitWidth { - NumberAnimation { - duration: Style.animationNormal - easing.type: Easing.InOutCubic - } - } - - Behavior on implicitHeight { - NumberAnimation { - duration: Style.animationNormal - easing.type: Easing.InOutCubic - } - } - - function calculateContentWidth() { - // Calculate the actual content width based on visible elements - var contentWidth = 0; - var margins = Style.margin2S; // Left and right margins - - // Icon width (if visible) - if (showIcon) { - contentWidth += iconSize; - contentWidth += Style.marginS; // Spacing after icon + property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] || {} + // Explicit screenName property ensures reactive binding when screen changes + readonly property string screenName: screen ? screen.name : "" + property var widgetSettings: { + if (section && sectionWidgetIndex >= 0 && screenName) { + var widgets = Settings.getBarWidgetsForScreen(screenName)[section]; + if (widgets && sectionWidgetIndex < widgets.length && widgets[sectionWidgetIndex]) { + return widgets[sectionWidgetIndex]; + } + } + return {}; } - // Text width (use the measured width) - contentWidth += titleContainer.measuredWidth; + // Widget settings - matching MediaMini pattern + readonly property bool showIcon: (widgetSettings.showIcon !== undefined) ? widgetSettings.showIcon : (widgetMetadata.showIcon || false) + readonly property bool showText: false //(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") - // Additional small margin for text - contentWidth += Style.margin2XXS; + // 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) - // Add container margins - contentWidth += margins; + readonly property string barPosition: Settings.getBarPositionForScreen(screenName) + readonly property bool isVerticalBar: barPosition === "left" || barPosition === "right" + readonly property real barHeight: Style.getBarHeightForScreen(screenName) + readonly property real capsuleHeight: Style.getCapsuleHeightForScreen(screenName) + readonly property real barFontSize: Style.getBarFontSizeForScreen(screenName) + readonly property bool hasFocusedWindow: CompositorService.getFocusedWindow() !== null + readonly property string windowTitle: CompositorService.getFocusedWindowTitle() || "No active window" + readonly property string fallbackIcon: "user-desktop" - return Math.ceil(contentWidth); - } + readonly property int iconSize: Style.toOdd(capsuleHeight * 0.75) + readonly property int verticalSize: Style.toOdd(capsuleHeight * 0.85) - // Dynamic width: adapt to content but respect maximum width setting - readonly property real dynamicWidth: { - // If using fixed width mode, always use maxWidth - if (useFixedWidth) { - return maxWidth; + // For horizontal bars, height is always barHeight (no animation needed) + // For vertical bars, collapse to 0 when hidden + implicitHeight: isVerticalBar ? (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : verticalSize) : barHeight + implicitWidth: isVerticalBar ? (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : verticalSize) : (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : dynamicWidth) + + // "visible": Always Visible, "hidden": Hide When Empty, "transparent": Transparent When Empty + visible: (hideMode !== "hidden" || hasFocusedWindow) || opacity > 0 + opacity: ((hideMode !== "hidden" || hasFocusedWindow) && (hideMode !== "transparent" || hasFocusedWindow)) ? 1.0 : 0.0 + Behavior on opacity { + NumberAnimation { + duration: Style.animationNormal + easing.type: Easing.OutCubic + } } - // Otherwise, adapt to content - if (!hasFocusedWindow) { - return Math.min(calculateContentWidth(), maxWidth); - } - // Use content width but don't exceed user-set maximum width - return Math.min(calculateContentWidth(), maxWidth); - } - function getAppIcon() { - try { - // Try CompositorService first - const focusedWindow = CompositorService.getFocusedWindow(); - if (focusedWindow && focusedWindow.appId) { + Behavior on implicitWidth { + NumberAnimation { + duration: Style.animationNormal + easing.type: Easing.InOutCubic + } + } + + Behavior on implicitHeight { + NumberAnimation { + duration: Style.animationNormal + easing.type: Easing.InOutCubic + } + } + + function calculateContentWidth() { + // Calculate the actual content width based on visible elements + var contentWidth = 0; + var margins = Style.margin2S; // Left and right margins + + // Icon width (if visible) + if (showIcon) { + contentWidth += iconSize; + if (showText) { + contentWidth += Style.marginS; // Spacing after icon + } + } + + // Text width (use the measured width) + if (showText) { + contentWidth += titleContainer.measuredWidth; + // Additional small margin for text + contentWidth += Style.margin2XXS; + } + + // Add container margins + contentWidth += margins; + + return Math.ceil(contentWidth); + } + + // Dynamic width: adapt to content but respect maximum width setting + readonly property real dynamicWidth: { + // If using fixed width mode, always use maxWidth + if (useFixedWidth) { + return maxWidth; + } + // Otherwise, adapt to content + if (!hasFocusedWindow) { + return Math.min(calculateContentWidth(), maxWidth); + } + // Use content width but don't exceed user-set maximum width + return Math.min(calculateContentWidth(), maxWidth); + } + + function getAppIcon() { try { - const idValue = focusedWindow.appId; - const normalizedId = (typeof idValue === 'string') ? idValue : String(idValue); - const iconResult = ThemeIcons.iconForAppId(normalizedId.toLowerCase()); - if (iconResult && iconResult !== "") { - return iconResult; - } - } catch (iconError) { - Logger.w("ActiveWindow", "Error getting icon from CompositorService:", iconError); - } - } - - if (CompositorService.isHyprland) { - // Fallback to ToplevelManager - if (ToplevelManager && ToplevelManager.activeToplevel) { - try { - const activeToplevel = ToplevelManager.activeToplevel; - if (activeToplevel.appId) { - const idValue2 = activeToplevel.appId; - const normalizedId2 = (typeof idValue2 === 'string') ? idValue2 : String(idValue2); - const iconResult2 = ThemeIcons.iconForAppId(normalizedId2.toLowerCase()); - if (iconResult2 && iconResult2 !== "") { - return iconResult2; - } + // Try CompositorService first + const focusedWindow = CompositorService.getFocusedWindow(); + if (focusedWindow && focusedWindow.appId) { + try { + const idValue = focusedWindow.appId; + const normalizedId = (typeof idValue === 'string') ? idValue : String(idValue); + const iconResult = ThemeIcons.iconForAppId(normalizedId.toLowerCase()); + if (iconResult && iconResult !== "") { + return iconResult; + } + } catch (iconError) { + Logger.w("ActiveWindow", "Error getting icon from CompositorService:", iconError); + } } - } catch (fallbackError) { - Logger.w("ActiveWindow", "Error getting icon from ToplevelManager:", fallbackError); - } + + if (CompositorService.isHyprland) { + // Fallback to ToplevelManager + if (ToplevelManager && ToplevelManager.activeToplevel) { + try { + const activeToplevel = ToplevelManager.activeToplevel; + if (activeToplevel.appId) { + const idValue2 = activeToplevel.appId; + const normalizedId2 = (typeof idValue2 === 'string') ? idValue2 : String(idValue2); + const iconResult2 = ThemeIcons.iconForAppId(normalizedId2.toLowerCase()); + if (iconResult2 && iconResult2 !== "") { + return iconResult2; + } + } + } catch (fallbackError) { + Logger.w("ActiveWindow", "Error getting icon from ToplevelManager:", fallbackError); + } + } + } + + return ThemeIcons.iconFromName(fallbackIcon); + } catch (e) { + Logger.w("ActiveWindow", "Error in getAppIcon:", e); + return ThemeIcons.iconFromName(fallbackIcon); } - } - - return ThemeIcons.iconFromName(fallbackIcon); - } catch (e) { - Logger.w("ActiveWindow", "Error in getAppIcon:", e); - return ThemeIcons.iconFromName(fallbackIcon); - } - } - - NPopupContextMenu { - id: contextMenu - - model: [ - { - "label": I18n.tr("actions.widget-settings"), - "action": "widget-settings", - "icon": "settings" - }, - ] - - onTriggered: action => { - contextMenu.close(); - PanelService.closeContextMenu(screen); - - if (action === "widget-settings") { - BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings); - } - } - } - - Rectangle { - id: windowActiveRect - visible: root.visible - x: isVerticalBar ? Style.pixelAlignCenter(parent.width, width) : 0 - y: isVerticalBar ? 0 : Style.pixelAlignCenter(parent.height, height) - width: isVerticalBar ? ((!hasFocusedWindow) && hideMode === "hidden" ? 0 : verticalSize) : ((!hasFocusedWindow) && (hideMode === "hidden") ? 0 : dynamicWidth) - height: isVerticalBar ? ((!hasFocusedWindow) && hideMode === "hidden" ? 0 : verticalSize) : capsuleHeight - radius: Style.radiusM - color: Style.capsuleColor - border.color: Style.capsuleBorderColor - border.width: Style.capsuleBorderWidth - - // Smooth width transition - Behavior on width { - NumberAnimation { - duration: Style.animationNormal - easing.type: Easing.InOutCubic - } } - Item { - id: mainContainer - anchors.fill: parent - anchors.leftMargin: isVerticalBar ? 0 : Style.marginS - anchors.rightMargin: isVerticalBar ? 0 : Style.marginS + NPopupContextMenu { + id: contextMenu - // Horizontal layout for top/bottom bars - RowLayout { - id: rowLayout - anchors.verticalCenter: parent.verticalCenter - spacing: Style.marginS - visible: !isVerticalBar - z: 1 + model: [ + { + "label": I18n.tr("actions.widget-settings"), + "action": "widget-settings", + "icon": "settings" + }, + ] + + onTriggered: action => { + contextMenu.close(); + PanelService.closeContextMenu(screen); + + if (action === "widget-settings") { + BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings); + } + } + } + + Rectangle { + id: windowActiveRect + visible: root.visible + x: isVerticalBar ? Style.pixelAlignCenter(parent.width, width) : 0 + y: isVerticalBar ? 0 : Style.pixelAlignCenter(parent.height, height) + width: isVerticalBar ? ((!hasFocusedWindow) && hideMode === "hidden" ? 0 : verticalSize) : ((!hasFocusedWindow) && (hideMode === "hidden") ? 0 : dynamicWidth) + height: isVerticalBar ? ((!hasFocusedWindow) && hideMode === "hidden" ? 0 : verticalSize) : capsuleHeight + radius: Style.radiusM + color: Style.capsuleColor + border.color: Style.capsuleBorderColor + border.width: Style.capsuleBorderWidth + + // Smooth width transition + Behavior on width { + NumberAnimation { + duration: Style.animationNormal + easing.type: Easing.InOutCubic + } + } - // Window icon Item { - Layout.preferredWidth: iconSize - Layout.preferredHeight: iconSize - Layout.alignment: Qt.AlignVCenter - visible: showIcon - - IconImage { - id: windowIcon + id: mainContainer anchors.fill: parent - source: getAppIcon() - asynchronous: true - smooth: true - visible: source !== "" + anchors.leftMargin: isVerticalBar ? 0 : Style.marginS + anchors.rightMargin: isVerticalBar ? 0 : Style.marginS - // Apply dock shader to active window icon (always themed) - layer.enabled: widgetSettings.colorizeIcons !== false - layer.effect: ShaderEffect { - property color targetColor: Settings.data.colorSchemes.darkMode ? Color.mOnSurface : Color.mSurfaceVariant - property real colorizeMode: 0.0 // Dock mode (grayscale) + // Horizontal layout for top/bottom bars + RowLayout { + id: rowLayout + anchors.verticalCenter: parent.verticalCenter + spacing: Style.marginS + visible: !isVerticalBar + z: 1 - fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb") + // Window icon + Item { + Layout.preferredWidth: iconSize + Layout.preferredHeight: iconSize + Layout.alignment: Qt.AlignVCenter + visible: showIcon + + IconImage { + id: windowIcon + anchors.fill: parent + source: getAppIcon() + asynchronous: true + smooth: true + visible: source !== "" + + // Apply dock shader to active window icon (always themed) + layer.enabled: widgetSettings.colorizeIcons !== false + layer.effect: ShaderEffect { + property color targetColor: Settings.data.colorSchemes.darkMode ? Color.mOnSurface : Color.mSurfaceVariant + property real colorizeMode: 0.0 // Dock mode (grayscale) + + fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb") + } + } + } + + NScrollText { + id: titleContainer + text: windowTitle + Layout.alignment: Qt.AlignVCenter + Layout.preferredHeight: root.capsuleHeight + fadeRoundLeftCorners: !showIcon + visible: showText + + maxWidth: { + // Calculate available width based on other elements + var iconWidth = (showIcon && windowIcon.visible ? (iconSize + Style.marginS) : 0); + var totalMargins = Style.margin2XXS; + var availableWidth = mainContainer.width - iconWidth - totalMargins; + return Math.max(20, availableWidth); + } + scrollMode: { + if (scrollingMode === "always") + return NScrollText.ScrollMode.Always; + if (scrollingMode === "hover") + return NScrollText.ScrollMode.Hover; + return NScrollText.ScrollMode.Never; + } + forcedHover: mainMouseArea.containsMouse + fadeExtent: 0.1 + fadeCornerRadius: Style.radiusM + + NText { + text: windowTitle + pointSize: barFontSize + applyUiScale: false + font.weight: Style.fontWeightMedium + color: root.textColor + } + } } - } - } - NScrollText { - id: titleContainer - text: windowTitle - Layout.alignment: Qt.AlignVCenter - Layout.preferredHeight: root.capsuleHeight - fadeRoundLeftCorners: !showIcon + // Vertical layout for left/right bars - icon only + Item { + id: verticalLayout + width: parent.width - Style.margin2M + height: parent.height - Style.margin2M + x: Style.pixelAlignCenter(parent.width, width) + y: Style.pixelAlignCenter(parent.height, height) + visible: isVerticalBar + z: 1 - maxWidth: { - // Calculate available width based on other elements - var iconWidth = (showIcon && windowIcon.visible ? (iconSize + Style.marginS) : 0); - var totalMargins = Style.margin2XXS; - var availableWidth = mainContainer.width - iconWidth - totalMargins; - return Math.max(20, availableWidth); - } - scrollMode: { - if (scrollingMode === "always") - return NScrollText.ScrollMode.Always; - if (scrollingMode === "hover") - return NScrollText.ScrollMode.Hover; - return NScrollText.ScrollMode.Never; - } - forcedHover: mainMouseArea.containsMouse - fadeExtent: 0.1 - fadeCornerRadius: Style.radiusM + // Window icon + Item { + id: verticalIconContainer + width: root.iconSize + height: width + x: Style.pixelAlignCenter(parent.width, width) + y: Style.pixelAlignCenter(parent.height, height) + visible: windowTitle !== "" - NText { - text: windowTitle - pointSize: barFontSize - applyUiScale: false - font.weight: Style.fontWeightMedium - color: root.textColor - } - } - } + IconImage { + id: windowIconVertical + anchors.fill: parent + source: getAppIcon() + asynchronous: true + smooth: true + visible: source !== "" - // Vertical layout for left/right bars - icon only - Item { - id: verticalLayout - width: parent.width - Style.margin2M - height: parent.height - Style.margin2M - x: Style.pixelAlignCenter(parent.width, width) - y: Style.pixelAlignCenter(parent.height, height) - visible: isVerticalBar - z: 1 + // Apply dock shader to active window icon (always themed) + layer.enabled: widgetSettings.colorizeIcons !== false + layer.effect: ShaderEffect { + property color targetColor: Color.mOnSurface + property real colorizeMode: 0.0 // Dock mode (grayscale) - // Window icon - Item { - id: verticalIconContainer - width: root.iconSize - height: width - x: Style.pixelAlignCenter(parent.width, width) - y: Style.pixelAlignCenter(parent.height, height) - visible: windowTitle !== "" - - IconImage { - id: windowIconVertical - anchors.fill: parent - source: getAppIcon() - asynchronous: true - smooth: true - visible: source !== "" - - // Apply dock shader to active window icon (always themed) - layer.enabled: widgetSettings.colorizeIcons !== false - layer.effect: ShaderEffect { - property color targetColor: Color.mOnSurface - property real colorizeMode: 0.0 // Dock mode (grayscale) - - fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb") + fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb") + } + } + } } - } + + // Mouse area moved to root } - } - - // Mouse area moved to root } - } - // Mouse area for hover detection - MouseArea { - id: mainMouseArea - anchors.fill: parent + // Mouse area for hover detection + MouseArea { + id: mainMouseArea + anchors.fill: parent - // Extend click area to screen edge if widget is at the start/end - anchors.leftMargin: (!isVerticalBar && section === "left" && sectionWidgetIndex === 0) ? -Style.marginS : 0 - anchors.rightMargin: (!isVerticalBar && section === "right" && sectionWidgetIndex === sectionWidgetsCount - 1) ? -Style.marginS : 0 - anchors.topMargin: (isVerticalBar && section === "left" && sectionWidgetIndex === 0) ? -Style.marginM : 0 - anchors.bottomMargin: (isVerticalBar && section === "right" && sectionWidgetIndex === sectionWidgetsCount - 1) ? -Style.marginM : 0 + // Extend click area to screen edge if widget is at the start/end + anchors.leftMargin: (!isVerticalBar && section === "left" && sectionWidgetIndex === 0) ? -Style.marginS : 0 + anchors.rightMargin: (!isVerticalBar && section === "right" && sectionWidgetIndex === sectionWidgetsCount - 1) ? -Style.marginS : 0 + anchors.topMargin: (isVerticalBar && section === "left" && sectionWidgetIndex === 0) ? -Style.marginM : 0 + anchors.bottomMargin: (isVerticalBar && section === "right" && sectionWidgetIndex === sectionWidgetsCount - 1) ? -Style.marginM : 0 - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - acceptedButtons: Qt.LeftButton | Qt.RightButton - onEntered: { - if ((windowTitle !== "") && isVerticalBar || (scrollingMode === "never")) { - TooltipService.show(root, windowTitle, BarService.getTooltipDirection(root.screen?.name)); - } + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + acceptedButtons: Qt.LeftButton | Qt.RightButton + onEntered: { + if ((windowTitle !== "") && isVerticalBar || (scrollingMode === "never")) { + TooltipService.show(root, windowTitle, BarService.getTooltipDirection(root.screen?.name)); + } + } + onExited: { + TooltipService.hide(); + } + onClicked: mouse => { + if (mouse.button === Qt.RightButton) { + PanelService.showContextMenu(contextMenu, root, screen); + } + } } - onExited: { - TooltipService.hide(); - } - onClicked: mouse => { - if (mouse.button === Qt.RightButton) { - PanelService.showContextMenu(contextMenu, root, screen); - } - } - } - Connections { - target: CompositorService - function onActiveWindowChanged() { - try { - windowIcon.source = Qt.binding(getAppIcon); - windowIconVertical.source = Qt.binding(getAppIcon); - } catch (e) { - Logger.w("ActiveWindow", "Error in onActiveWindowChanged:", e); - } + Connections { + target: CompositorService + function onActiveWindowChanged() { + try { + windowIcon.source = Qt.binding(getAppIcon); + windowIconVertical.source = Qt.binding(getAppIcon); + } catch (e) { + Logger.w("ActiveWindow", "Error in onActiveWindowChanged:", e); + } + } + function onWindowListChanged() { + try { + windowIcon.source = Qt.binding(getAppIcon); + windowIconVertical.source = Qt.binding(getAppIcon); + } catch (e) { + Logger.w("ActiveWindow", "Error in onWindowListChanged:", e); + } + } } - function onWindowListChanged() { - try { - windowIcon.source = Qt.binding(getAppIcon); - windowIconVertical.source = Qt.binding(getAppIcon); - } catch (e) { - Logger.w("ActiveWindow", "Error in onWindowListChanged:", e); - } - } - } } From 95dfb2ade2856ce38641829194e1b76f11951c9c Mon Sep 17 00:00:00 2001 From: Corey Woodworth <8398380+MrDowntempo@users.noreply.github.com> Date: Tue, 31 Mar 2026 03:12:22 -0400 Subject: [PATCH 2/6] chore(i18n): Add englisht strings for the text toggle --- Assets/Translations/en.json | 4 +- .../WidgetSettings/ActiveWindowSettings.qml | 280 +++++++++--------- 2 files changed, 150 insertions(+), 134 deletions(-) diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index 4993c6444..02295280c 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -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.", diff --git a/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml b/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml index 7fbecd6dd..6cfc78ce0 100644 --- a/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml +++ b/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml @@ -5,150 +5,164 @@ import qs.Commons import qs.Widgets ColumnLayout { - id: root - spacing: Style.marginM + id: root + spacing: Style.marginM - // Properties to receive data from parent - property var screen: null - property var widgetData: null - property var widgetMetadata: null + // Properties to receive data from parent + property var screen: null + property var widgetData: null + property var widgetMetadata: null - signal settingsChanged(var settings) + signal settingsChanged(var settings) - // Local state - property bool valueShowIcon: widgetData.showIcon !== undefined ? widgetData.showIcon : widgetMetadata.showIcon - 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 - 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 + // 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 + 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) { - valueHideMode = widgetData.hideMode; + Component.onCompleted: { + if (widgetData && widgetData.hideMode !== undefined) { + valueHideMode = widgetData.hideMode; + } } - } - function saveSettings() { - var settings = Object.assign({}, widgetData || {}); - settings.hideMode = valueHideMode; - settings.showIcon = valueShowIcon; - settings.scrollingMode = valueScrollingMode; - settings.maxWidth = parseInt(widthInput.text) || widgetMetadata.maxWidth; - settings.useFixedWidth = valueUseFixedWidth; - settings.colorizeIcons = valueColorizeIcons; - settings.textColor = valueTextColor; - settingsChanged(settings); - } + function saveSettings() { + 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; + settings.colorizeIcons = valueColorizeIcons; + settings.textColor = valueTextColor; + settingsChanged(settings); + } - NComboBox { - Layout.fillWidth: true - label: I18n.tr("bar.taskbar.hide-mode-label") - description: I18n.tr("bar.active-window.hide-mode-description") - model: [ - { - "key": "visible", - "name": I18n.tr("hide-modes.visible") - }, - { - "key": "hidden", - "name": I18n.tr("hide-modes.hidden") - }, - { - "key": "transparent", - "name": I18n.tr("hide-modes.transparent") - } - ] - currentKey: root.valueHideMode - onSelected: key => { - root.valueHideMode = key; - saveSettings(); - } - defaultValue: widgetMetadata.hideMode - } + NComboBox { + Layout.fillWidth: true + label: I18n.tr("bar.taskbar.hide-mode-label") + description: I18n.tr("bar.active-window.hide-mode-description") + model: [ + { + "key": "visible", + "name": I18n.tr("hide-modes.visible") + }, + { + "key": "hidden", + "name": I18n.tr("hide-modes.hidden") + }, + { + "key": "transparent", + "name": I18n.tr("hide-modes.transparent") + } + ] + currentKey: root.valueHideMode + onSelected: key => { + root.valueHideMode = key; + saveSettings(); + } + defaultValue: widgetMetadata.hideMode + } - NColorChoice { - label: I18n.tr("common.select-color") - currentKey: valueTextColor - onSelected: key => { - valueTextColor = key; - saveSettings(); - } - defaultValue: widgetMetadata.textColor - } + NColorChoice { + label: I18n.tr("common.select-color") + currentKey: valueTextColor + onSelected: key => { + valueTextColor = key; + saveSettings(); + } + defaultValue: widgetMetadata.textColor + } - NToggle { - Layout.fillWidth: true - label: I18n.tr("bar.active-window.show-app-icon-label") - description: I18n.tr("bar.active-window.show-app-icon-description") - checked: root.valueShowIcon - onToggled: checked => { - root.valueShowIcon = checked; - saveSettings(); - } - defaultValue: widgetMetadata.showIcon - } + NToggle { + Layout.fillWidth: true + label: I18n.tr("bar.active-window.show-app-icon-label") + description: I18n.tr("bar.active-window.show-app-icon-description") + checked: root.valueShowIcon + onToggled: checked => { + root.valueShowIcon = checked; + saveSettings(); + } + defaultValue: widgetMetadata.showIcon + } - NToggle { - Layout.fillWidth: true - label: I18n.tr("bar.tray.colorize-icons-label") - description: I18n.tr("bar.active-window.colorize-icons-description") - checked: root.valueColorizeIcons - onToggled: checked => { - root.valueColorizeIcons = checked; - saveSettings(); - } - visible: root.valueShowIcon - defaultValue: widgetMetadata.colorizeIcons - } + NToggle { + Layout.fillWidth: true + label: I18n.tr("bar.tray.colorize-icons-label") + description: I18n.tr("bar.active-window.colorize-icons-description") + checked: root.valueColorizeIcons + onToggled: checked => { + root.valueColorizeIcons = checked; + saveSettings(); + } + visible: root.valueShowIcon + defaultValue: widgetMetadata.colorizeIcons + } - NTextInput { - id: widthInput - Layout.fillWidth: true - label: I18n.tr("bar.taskbar.max-width-label") - description: I18n.tr("bar.media-mini.max-width-description") - placeholderText: widgetMetadata.maxWidth - text: valueMaxWidth - onTextChanged: saveSettings() - defaultValue: String(widgetMetadata.maxWidth) - } + 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.media-mini.use-fixed-width-label") - description: I18n.tr("bar.media-mini.use-fixed-width-description") - checked: valueUseFixedWidth - onToggled: checked => { - valueUseFixedWidth = checked; - saveSettings(); - } - defaultValue: widgetMetadata.useFixedWidth - } + NTextInput { + id: widthInput + Layout.fillWidth: true + label: I18n.tr("bar.taskbar.max-width-label") + description: I18n.tr("bar.media-mini.max-width-description") + placeholderText: widgetMetadata.maxWidth + text: valueMaxWidth + onTextChanged: saveSettings() + defaultValue: String(widgetMetadata.maxWidth) + } - NComboBox { - label: I18n.tr("bar.media-mini.scrolling-mode-label") - description: I18n.tr("bar.active-window.scrolling-mode-description") - model: [ - { - "key": "always", - "name": I18n.tr("options.scrolling-modes.always") - }, - { - "key": "hover", - "name": I18n.tr("options.scrolling-modes.hover") - }, - { - "key": "never", - "name": I18n.tr("options.scrolling-modes.never") - } - ] - currentKey: valueScrollingMode - defaultValue: widgetMetadata.scrollingMode - onSelected: key => { - valueScrollingMode = key; - saveSettings(); - } - minimumWidth: 200 - } + NToggle { + Layout.fillWidth: true + label: I18n.tr("bar.media-mini.use-fixed-width-label") + description: I18n.tr("bar.media-mini.use-fixed-width-description") + checked: valueUseFixedWidth + onToggled: checked => { + valueUseFixedWidth = checked; + saveSettings(); + } + defaultValue: widgetMetadata.useFixedWidth + } + + NComboBox { + label: I18n.tr("bar.media-mini.scrolling-mode-label") + description: I18n.tr("bar.active-window.scrolling-mode-description") + model: [ + { + "key": "always", + "name": I18n.tr("options.scrolling-modes.always") + }, + { + "key": "hover", + "name": I18n.tr("options.scrolling-modes.hover") + }, + { + "key": "never", + "name": I18n.tr("options.scrolling-modes.never") + } + ] + currentKey: valueScrollingMode + defaultValue: widgetMetadata.scrollingMode + onSelected: key => { + valueScrollingMode = key; + saveSettings(); + } + minimumWidth: 200 + } } From 0c9d3b83beae453bbb6f2449e2cd3dc6c66dd1b5 Mon Sep 17 00:00:00 2001 From: Corey Woodworth <8398380+MrDowntempo@users.noreply.github.com> Date: Tue, 31 Mar 2026 03:18:49 -0400 Subject: [PATCH 3/6] chore: add modified files again because they were not staged (I don't get git sometimes) --- Modules/Bar/Widgets/ActiveWindow.qml | 2 +- .../WidgetSettings/ActiveWindowSettings.qml | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Modules/Bar/Widgets/ActiveWindow.qml b/Modules/Bar/Widgets/ActiveWindow.qml index c9099bd2b..cd21f479f 100644 --- a/Modules/Bar/Widgets/ActiveWindow.qml +++ b/Modules/Bar/Widgets/ActiveWindow.qml @@ -40,7 +40,7 @@ Item { // Widget settings - matching MediaMini pattern readonly property bool showIcon: (widgetSettings.showIcon !== undefined) ? widgetSettings.showIcon : (widgetMetadata.showIcon || false) - readonly property bool showText: false //(widgetSettings.showText !== undefined) ? widgetSettings.showText : (widgetMetadata.showText || 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") diff --git a/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml b/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml index 6cfc78ce0..bfe7fbbbd 100644 --- a/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml +++ b/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml @@ -80,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") @@ -105,18 +117,6 @@ ColumnLayout { defaultValue: widgetMetadata.colorizeIcons } - 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 - } - NTextInput { id: widthInput Layout.fillWidth: true From 900e1f1286340f98ad464b617aad13068a7c0d22 Mon Sep 17 00:00:00 2001 From: Corey Woodworth <8398380+MrDowntempo@users.noreply.github.com> Date: Tue, 31 Mar 2026 03:36:26 -0400 Subject: [PATCH 4/6] chore: run qmlfmt.sh --- Modules/Bar/Widgets/ActiveWindow.qml | 686 +++++++++--------- .../WidgetSettings/ActiveWindowSettings.qml | 292 ++++---- 2 files changed, 489 insertions(+), 489 deletions(-) diff --git a/Modules/Bar/Widgets/ActiveWindow.qml b/Modules/Bar/Widgets/ActiveWindow.qml index cd21f479f..12f197ddd 100644 --- a/Modules/Bar/Widgets/ActiveWindow.qml +++ b/Modules/Bar/Widgets/ActiveWindow.qml @@ -11,375 +11,375 @@ import qs.Services.UI import qs.Widgets Item { - id: root - Layout.preferredHeight: isVerticalBar ? -1 : Style.getBarHeightForScreen(screenName) - Layout.preferredWidth: isVerticalBar ? Style.getBarHeightForScreen(screenName) : -1 - Layout.fillHeight: false - Layout.fillWidth: false + id: root + Layout.preferredHeight: isVerticalBar ? -1 : Style.getBarHeightForScreen(screenName) + Layout.preferredWidth: isVerticalBar ? Style.getBarHeightForScreen(screenName) : -1 + Layout.fillHeight: false + Layout.fillWidth: false - property ShellScreen screen + property ShellScreen screen - // Widget properties passed from Bar.qml for per-instance settings - property string widgetId: "" - property string section: "" - property int sectionWidgetIndex: -1 - property int sectionWidgetsCount: 0 + // Widget properties passed from Bar.qml for per-instance settings + property string widgetId: "" + property string section: "" + property int sectionWidgetIndex: -1 + property int sectionWidgetsCount: 0 - property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] || {} - // Explicit screenName property ensures reactive binding when screen changes - readonly property string screenName: screen ? screen.name : "" - property var widgetSettings: { - if (section && sectionWidgetIndex >= 0 && screenName) { - var widgets = Settings.getBarWidgetsForScreen(screenName)[section]; - if (widgets && sectionWidgetIndex < widgets.length && widgets[sectionWidgetIndex]) { - return widgets[sectionWidgetIndex]; - } - } - return {}; + property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] || {} + // Explicit screenName property ensures reactive binding when screen changes + readonly property string screenName: screen ? screen.name : "" + property var widgetSettings: { + if (section && sectionWidgetIndex >= 0 && screenName) { + var widgets = Settings.getBarWidgetsForScreen(screenName)[section]; + if (widgets && sectionWidgetIndex < widgets.length && widgets[sectionWidgetIndex]) { + return widgets[sectionWidgetIndex]; + } + } + return {}; + } + + // 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") + + // 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" + readonly property real barHeight: Style.getBarHeightForScreen(screenName) + readonly property real capsuleHeight: Style.getCapsuleHeightForScreen(screenName) + readonly property real barFontSize: Style.getBarFontSizeForScreen(screenName) + readonly property bool hasFocusedWindow: CompositorService.getFocusedWindow() !== null + readonly property string windowTitle: CompositorService.getFocusedWindowTitle() || "No active window" + readonly property string fallbackIcon: "user-desktop" + + readonly property int iconSize: Style.toOdd(capsuleHeight * 0.75) + readonly property int verticalSize: Style.toOdd(capsuleHeight * 0.85) + + // For horizontal bars, height is always barHeight (no animation needed) + // For vertical bars, collapse to 0 when hidden + implicitHeight: isVerticalBar ? (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : verticalSize) : barHeight + implicitWidth: isVerticalBar ? (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : verticalSize) : (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : dynamicWidth) + + // "visible": Always Visible, "hidden": Hide When Empty, "transparent": Transparent When Empty + visible: (hideMode !== "hidden" || hasFocusedWindow) || opacity > 0 + opacity: ((hideMode !== "hidden" || hasFocusedWindow) && (hideMode !== "transparent" || hasFocusedWindow)) ? 1.0 : 0.0 + Behavior on opacity { + NumberAnimation { + duration: Style.animationNormal + easing.type: Easing.OutCubic + } + } + + Behavior on implicitWidth { + NumberAnimation { + duration: Style.animationNormal + easing.type: Easing.InOutCubic + } + } + + Behavior on implicitHeight { + NumberAnimation { + duration: Style.animationNormal + easing.type: Easing.InOutCubic + } + } + + function calculateContentWidth() { + // Calculate the actual content width based on visible elements + var contentWidth = 0; + var margins = Style.margin2S; // Left and right margins + + // Icon width (if visible) + if (showIcon) { + contentWidth += iconSize; + if (showText) { + contentWidth += Style.marginS; // Spacing after icon + } } - // 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") - - // 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" - readonly property real barHeight: Style.getBarHeightForScreen(screenName) - readonly property real capsuleHeight: Style.getCapsuleHeightForScreen(screenName) - readonly property real barFontSize: Style.getBarFontSizeForScreen(screenName) - readonly property bool hasFocusedWindow: CompositorService.getFocusedWindow() !== null - readonly property string windowTitle: CompositorService.getFocusedWindowTitle() || "No active window" - readonly property string fallbackIcon: "user-desktop" - - readonly property int iconSize: Style.toOdd(capsuleHeight * 0.75) - readonly property int verticalSize: Style.toOdd(capsuleHeight * 0.85) - - // For horizontal bars, height is always barHeight (no animation needed) - // For vertical bars, collapse to 0 when hidden - implicitHeight: isVerticalBar ? (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : verticalSize) : barHeight - implicitWidth: isVerticalBar ? (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : verticalSize) : (((!hasFocusedWindow) && hideMode === "hidden") ? 0 : dynamicWidth) - - // "visible": Always Visible, "hidden": Hide When Empty, "transparent": Transparent When Empty - visible: (hideMode !== "hidden" || hasFocusedWindow) || opacity > 0 - opacity: ((hideMode !== "hidden" || hasFocusedWindow) && (hideMode !== "transparent" || hasFocusedWindow)) ? 1.0 : 0.0 - Behavior on opacity { - NumberAnimation { - duration: Style.animationNormal - easing.type: Easing.OutCubic - } + // Text width (use the measured width) + if (showText) { + contentWidth += titleContainer.measuredWidth; + // Additional small margin for text + contentWidth += Style.margin2XXS; } - Behavior on implicitWidth { - NumberAnimation { - duration: Style.animationNormal - easing.type: Easing.InOutCubic - } + // Add container margins + contentWidth += margins; + + return Math.ceil(contentWidth); + } + + // Dynamic width: adapt to content but respect maximum width setting + readonly property real dynamicWidth: { + // If using fixed width mode, always use maxWidth + if (useFixedWidth) { + return maxWidth; } - - Behavior on implicitHeight { - NumberAnimation { - duration: Style.animationNormal - easing.type: Easing.InOutCubic - } + // Otherwise, adapt to content + if (!hasFocusedWindow) { + return Math.min(calculateContentWidth(), maxWidth); } + // Use content width but don't exceed user-set maximum width + return Math.min(calculateContentWidth(), maxWidth); + } - function calculateContentWidth() { - // Calculate the actual content width based on visible elements - var contentWidth = 0; - var margins = Style.margin2S; // Left and right margins - - // Icon width (if visible) - if (showIcon) { - contentWidth += iconSize; - if (showText) { - contentWidth += Style.marginS; // Spacing after icon - } - } - - // Text width (use the measured width) - if (showText) { - contentWidth += titleContainer.measuredWidth; - // Additional small margin for text - contentWidth += Style.margin2XXS; - } - - // Add container margins - contentWidth += margins; - - return Math.ceil(contentWidth); - } - - // Dynamic width: adapt to content but respect maximum width setting - readonly property real dynamicWidth: { - // If using fixed width mode, always use maxWidth - if (useFixedWidth) { - return maxWidth; - } - // Otherwise, adapt to content - if (!hasFocusedWindow) { - return Math.min(calculateContentWidth(), maxWidth); - } - // Use content width but don't exceed user-set maximum width - return Math.min(calculateContentWidth(), maxWidth); - } - - function getAppIcon() { + function getAppIcon() { + try { + // Try CompositorService first + const focusedWindow = CompositorService.getFocusedWindow(); + if (focusedWindow && focusedWindow.appId) { try { - // Try CompositorService first - const focusedWindow = CompositorService.getFocusedWindow(); - if (focusedWindow && focusedWindow.appId) { - try { - const idValue = focusedWindow.appId; - const normalizedId = (typeof idValue === 'string') ? idValue : String(idValue); - const iconResult = ThemeIcons.iconForAppId(normalizedId.toLowerCase()); - if (iconResult && iconResult !== "") { - return iconResult; - } - } catch (iconError) { - Logger.w("ActiveWindow", "Error getting icon from CompositorService:", iconError); - } - } - - if (CompositorService.isHyprland) { - // Fallback to ToplevelManager - if (ToplevelManager && ToplevelManager.activeToplevel) { - try { - const activeToplevel = ToplevelManager.activeToplevel; - if (activeToplevel.appId) { - const idValue2 = activeToplevel.appId; - const normalizedId2 = (typeof idValue2 === 'string') ? idValue2 : String(idValue2); - const iconResult2 = ThemeIcons.iconForAppId(normalizedId2.toLowerCase()); - if (iconResult2 && iconResult2 !== "") { - return iconResult2; - } - } - } catch (fallbackError) { - Logger.w("ActiveWindow", "Error getting icon from ToplevelManager:", fallbackError); - } - } - } - - return ThemeIcons.iconFromName(fallbackIcon); - } catch (e) { - Logger.w("ActiveWindow", "Error in getAppIcon:", e); - return ThemeIcons.iconFromName(fallbackIcon); + const idValue = focusedWindow.appId; + const normalizedId = (typeof idValue === 'string') ? idValue : String(idValue); + const iconResult = ThemeIcons.iconForAppId(normalizedId.toLowerCase()); + if (iconResult && iconResult !== "") { + return iconResult; + } + } catch (iconError) { + Logger.w("ActiveWindow", "Error getting icon from CompositorService:", iconError); } + } + + if (CompositorService.isHyprland) { + // Fallback to ToplevelManager + if (ToplevelManager && ToplevelManager.activeToplevel) { + try { + const activeToplevel = ToplevelManager.activeToplevel; + if (activeToplevel.appId) { + const idValue2 = activeToplevel.appId; + const normalizedId2 = (typeof idValue2 === 'string') ? idValue2 : String(idValue2); + const iconResult2 = ThemeIcons.iconForAppId(normalizedId2.toLowerCase()); + if (iconResult2 && iconResult2 !== "") { + return iconResult2; + } + } + } catch (fallbackError) { + Logger.w("ActiveWindow", "Error getting icon from ToplevelManager:", fallbackError); + } + } + } + + return ThemeIcons.iconFromName(fallbackIcon); + } catch (e) { + Logger.w("ActiveWindow", "Error in getAppIcon:", e); + return ThemeIcons.iconFromName(fallbackIcon); + } + } + + NPopupContextMenu { + id: contextMenu + + model: [ + { + "label": I18n.tr("actions.widget-settings"), + "action": "widget-settings", + "icon": "settings" + }, + ] + + onTriggered: action => { + contextMenu.close(); + PanelService.closeContextMenu(screen); + + if (action === "widget-settings") { + BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings); + } + } + } + + Rectangle { + id: windowActiveRect + visible: root.visible + x: isVerticalBar ? Style.pixelAlignCenter(parent.width, width) : 0 + y: isVerticalBar ? 0 : Style.pixelAlignCenter(parent.height, height) + width: isVerticalBar ? ((!hasFocusedWindow) && hideMode === "hidden" ? 0 : verticalSize) : ((!hasFocusedWindow) && (hideMode === "hidden") ? 0 : dynamicWidth) + height: isVerticalBar ? ((!hasFocusedWindow) && hideMode === "hidden" ? 0 : verticalSize) : capsuleHeight + radius: Style.radiusM + color: Style.capsuleColor + border.color: Style.capsuleBorderColor + border.width: Style.capsuleBorderWidth + + // Smooth width transition + Behavior on width { + NumberAnimation { + duration: Style.animationNormal + easing.type: Easing.InOutCubic + } } - NPopupContextMenu { - id: contextMenu + Item { + id: mainContainer + anchors.fill: parent + anchors.leftMargin: isVerticalBar ? 0 : Style.marginS + anchors.rightMargin: isVerticalBar ? 0 : Style.marginS - model: [ - { - "label": I18n.tr("actions.widget-settings"), - "action": "widget-settings", - "icon": "settings" - }, - ] - - onTriggered: action => { - contextMenu.close(); - PanelService.closeContextMenu(screen); - - if (action === "widget-settings") { - BarService.openWidgetSettings(screen, section, sectionWidgetIndex, widgetId, widgetSettings); - } - } - } - - Rectangle { - id: windowActiveRect - visible: root.visible - x: isVerticalBar ? Style.pixelAlignCenter(parent.width, width) : 0 - y: isVerticalBar ? 0 : Style.pixelAlignCenter(parent.height, height) - width: isVerticalBar ? ((!hasFocusedWindow) && hideMode === "hidden" ? 0 : verticalSize) : ((!hasFocusedWindow) && (hideMode === "hidden") ? 0 : dynamicWidth) - height: isVerticalBar ? ((!hasFocusedWindow) && hideMode === "hidden" ? 0 : verticalSize) : capsuleHeight - radius: Style.radiusM - color: Style.capsuleColor - border.color: Style.capsuleBorderColor - border.width: Style.capsuleBorderWidth - - // Smooth width transition - Behavior on width { - NumberAnimation { - duration: Style.animationNormal - easing.type: Easing.InOutCubic - } - } + // Horizontal layout for top/bottom bars + RowLayout { + id: rowLayout + anchors.verticalCenter: parent.verticalCenter + spacing: Style.marginS + visible: !isVerticalBar + z: 1 + // Window icon Item { - id: mainContainer + Layout.preferredWidth: iconSize + Layout.preferredHeight: iconSize + Layout.alignment: Qt.AlignVCenter + visible: showIcon + + IconImage { + id: windowIcon anchors.fill: parent - anchors.leftMargin: isVerticalBar ? 0 : Style.marginS - anchors.rightMargin: isVerticalBar ? 0 : Style.marginS + source: getAppIcon() + asynchronous: true + smooth: true + visible: source !== "" - // Horizontal layout for top/bottom bars - RowLayout { - id: rowLayout - anchors.verticalCenter: parent.verticalCenter - spacing: Style.marginS - visible: !isVerticalBar - z: 1 + // Apply dock shader to active window icon (always themed) + layer.enabled: widgetSettings.colorizeIcons !== false + layer.effect: ShaderEffect { + property color targetColor: Settings.data.colorSchemes.darkMode ? Color.mOnSurface : Color.mSurfaceVariant + property real colorizeMode: 0.0 // Dock mode (grayscale) - // Window icon - Item { - Layout.preferredWidth: iconSize - Layout.preferredHeight: iconSize - Layout.alignment: Qt.AlignVCenter - visible: showIcon - - IconImage { - id: windowIcon - anchors.fill: parent - source: getAppIcon() - asynchronous: true - smooth: true - visible: source !== "" - - // Apply dock shader to active window icon (always themed) - layer.enabled: widgetSettings.colorizeIcons !== false - layer.effect: ShaderEffect { - property color targetColor: Settings.data.colorSchemes.darkMode ? Color.mOnSurface : Color.mSurfaceVariant - property real colorizeMode: 0.0 // Dock mode (grayscale) - - fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb") - } - } - } - - NScrollText { - id: titleContainer - text: windowTitle - Layout.alignment: Qt.AlignVCenter - Layout.preferredHeight: root.capsuleHeight - fadeRoundLeftCorners: !showIcon - visible: showText - - maxWidth: { - // Calculate available width based on other elements - var iconWidth = (showIcon && windowIcon.visible ? (iconSize + Style.marginS) : 0); - var totalMargins = Style.margin2XXS; - var availableWidth = mainContainer.width - iconWidth - totalMargins; - return Math.max(20, availableWidth); - } - scrollMode: { - if (scrollingMode === "always") - return NScrollText.ScrollMode.Always; - if (scrollingMode === "hover") - return NScrollText.ScrollMode.Hover; - return NScrollText.ScrollMode.Never; - } - forcedHover: mainMouseArea.containsMouse - fadeExtent: 0.1 - fadeCornerRadius: Style.radiusM - - NText { - text: windowTitle - pointSize: barFontSize - applyUiScale: false - font.weight: Style.fontWeightMedium - color: root.textColor - } - } + fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb") } - - // Vertical layout for left/right bars - icon only - Item { - id: verticalLayout - width: parent.width - Style.margin2M - height: parent.height - Style.margin2M - x: Style.pixelAlignCenter(parent.width, width) - y: Style.pixelAlignCenter(parent.height, height) - visible: isVerticalBar - z: 1 - - // Window icon - Item { - id: verticalIconContainer - width: root.iconSize - height: width - x: Style.pixelAlignCenter(parent.width, width) - y: Style.pixelAlignCenter(parent.height, height) - visible: windowTitle !== "" - - IconImage { - id: windowIconVertical - anchors.fill: parent - source: getAppIcon() - asynchronous: true - smooth: true - visible: source !== "" - - // Apply dock shader to active window icon (always themed) - layer.enabled: widgetSettings.colorizeIcons !== false - layer.effect: ShaderEffect { - property color targetColor: Color.mOnSurface - property real colorizeMode: 0.0 // Dock mode (grayscale) - - fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb") - } - } - } - } - - // Mouse area moved to root + } } + + NScrollText { + id: titleContainer + text: windowTitle + Layout.alignment: Qt.AlignVCenter + Layout.preferredHeight: root.capsuleHeight + fadeRoundLeftCorners: !showIcon + visible: showText + + maxWidth: { + // Calculate available width based on other elements + var iconWidth = (showIcon && windowIcon.visible ? (iconSize + Style.marginS) : 0); + var totalMargins = Style.margin2XXS; + var availableWidth = mainContainer.width - iconWidth - totalMargins; + return Math.max(20, availableWidth); + } + scrollMode: { + if (scrollingMode === "always") + return NScrollText.ScrollMode.Always; + if (scrollingMode === "hover") + return NScrollText.ScrollMode.Hover; + return NScrollText.ScrollMode.Never; + } + forcedHover: mainMouseArea.containsMouse + fadeExtent: 0.1 + fadeCornerRadius: Style.radiusM + + NText { + text: windowTitle + pointSize: barFontSize + applyUiScale: false + font.weight: Style.fontWeightMedium + color: root.textColor + } + } + } + + // Vertical layout for left/right bars - icon only + Item { + id: verticalLayout + width: parent.width - Style.margin2M + height: parent.height - Style.margin2M + x: Style.pixelAlignCenter(parent.width, width) + y: Style.pixelAlignCenter(parent.height, height) + visible: isVerticalBar + z: 1 + + // Window icon + Item { + id: verticalIconContainer + width: root.iconSize + height: width + x: Style.pixelAlignCenter(parent.width, width) + y: Style.pixelAlignCenter(parent.height, height) + visible: windowTitle !== "" + + IconImage { + id: windowIconVertical + anchors.fill: parent + source: getAppIcon() + asynchronous: true + smooth: true + visible: source !== "" + + // Apply dock shader to active window icon (always themed) + layer.enabled: widgetSettings.colorizeIcons !== false + layer.effect: ShaderEffect { + property color targetColor: Color.mOnSurface + property real colorizeMode: 0.0 // Dock mode (grayscale) + + fragmentShader: Qt.resolvedUrl(Quickshell.shellDir + "/Shaders/qsb/appicon_colorize.frag.qsb") + } + } + } + } + + // Mouse area moved to root } + } - // Mouse area for hover detection - MouseArea { - id: mainMouseArea - anchors.fill: parent + // Mouse area for hover detection + MouseArea { + id: mainMouseArea + anchors.fill: parent - // Extend click area to screen edge if widget is at the start/end - anchors.leftMargin: (!isVerticalBar && section === "left" && sectionWidgetIndex === 0) ? -Style.marginS : 0 - anchors.rightMargin: (!isVerticalBar && section === "right" && sectionWidgetIndex === sectionWidgetsCount - 1) ? -Style.marginS : 0 - anchors.topMargin: (isVerticalBar && section === "left" && sectionWidgetIndex === 0) ? -Style.marginM : 0 - anchors.bottomMargin: (isVerticalBar && section === "right" && sectionWidgetIndex === sectionWidgetsCount - 1) ? -Style.marginM : 0 + // Extend click area to screen edge if widget is at the start/end + anchors.leftMargin: (!isVerticalBar && section === "left" && sectionWidgetIndex === 0) ? -Style.marginS : 0 + anchors.rightMargin: (!isVerticalBar && section === "right" && sectionWidgetIndex === sectionWidgetsCount - 1) ? -Style.marginS : 0 + anchors.topMargin: (isVerticalBar && section === "left" && sectionWidgetIndex === 0) ? -Style.marginM : 0 + anchors.bottomMargin: (isVerticalBar && section === "right" && sectionWidgetIndex === sectionWidgetsCount - 1) ? -Style.marginM : 0 - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - acceptedButtons: Qt.LeftButton | Qt.RightButton - onEntered: { - if ((windowTitle !== "") && isVerticalBar || (scrollingMode === "never")) { - TooltipService.show(root, windowTitle, BarService.getTooltipDirection(root.screen?.name)); - } - } - onExited: { - TooltipService.hide(); - } - onClicked: mouse => { - if (mouse.button === Qt.RightButton) { - PanelService.showContextMenu(contextMenu, root, screen); - } - } + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + acceptedButtons: Qt.LeftButton | Qt.RightButton + onEntered: { + if ((windowTitle !== "") && isVerticalBar || (scrollingMode === "never")) { + TooltipService.show(root, windowTitle, BarService.getTooltipDirection(root.screen?.name)); + } } - - Connections { - target: CompositorService - function onActiveWindowChanged() { - try { - windowIcon.source = Qt.binding(getAppIcon); - windowIconVertical.source = Qt.binding(getAppIcon); - } catch (e) { - Logger.w("ActiveWindow", "Error in onActiveWindowChanged:", e); - } - } - function onWindowListChanged() { - try { - windowIcon.source = Qt.binding(getAppIcon); - windowIconVertical.source = Qt.binding(getAppIcon); - } catch (e) { - Logger.w("ActiveWindow", "Error in onWindowListChanged:", e); - } - } + onExited: { + TooltipService.hide(); } + onClicked: mouse => { + if (mouse.button === Qt.RightButton) { + PanelService.showContextMenu(contextMenu, root, screen); + } + } + } + + Connections { + target: CompositorService + function onActiveWindowChanged() { + try { + windowIcon.source = Qt.binding(getAppIcon); + windowIconVertical.source = Qt.binding(getAppIcon); + } catch (e) { + Logger.w("ActiveWindow", "Error in onActiveWindowChanged:", e); + } + } + function onWindowListChanged() { + try { + windowIcon.source = Qt.binding(getAppIcon); + windowIconVertical.source = Qt.binding(getAppIcon); + } catch (e) { + Logger.w("ActiveWindow", "Error in onWindowListChanged:", e); + } + } + } } diff --git a/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml b/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml index bfe7fbbbd..f997fd6b2 100644 --- a/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml +++ b/Modules/Panels/Settings/Bar/WidgetSettings/ActiveWindowSettings.qml @@ -5,164 +5,164 @@ import qs.Commons import qs.Widgets ColumnLayout { - id: root - spacing: Style.marginM + id: root + spacing: Style.marginM - // Properties to receive data from parent - property var screen: null - property var widgetData: null - property var widgetMetadata: null + // Properties to receive data from parent + property var screen: null + property var widgetData: null + property var widgetMetadata: null - signal settingsChanged(var settings) + signal settingsChanged(var settings) - // 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 - 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 + // 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 + 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) { - valueHideMode = widgetData.hideMode; - } + Component.onCompleted: { + if (widgetData && widgetData.hideMode !== undefined) { + valueHideMode = widgetData.hideMode; } + } - function saveSettings() { - 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; - settings.colorizeIcons = valueColorizeIcons; - settings.textColor = valueTextColor; - settingsChanged(settings); - } + function saveSettings() { + 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; + settings.colorizeIcons = valueColorizeIcons; + settings.textColor = valueTextColor; + settingsChanged(settings); + } - NComboBox { - Layout.fillWidth: true - label: I18n.tr("bar.taskbar.hide-mode-label") - description: I18n.tr("bar.active-window.hide-mode-description") - model: [ - { - "key": "visible", - "name": I18n.tr("hide-modes.visible") - }, - { - "key": "hidden", - "name": I18n.tr("hide-modes.hidden") - }, - { - "key": "transparent", - "name": I18n.tr("hide-modes.transparent") - } - ] - currentKey: root.valueHideMode - onSelected: key => { - root.valueHideMode = key; - saveSettings(); - } - defaultValue: widgetMetadata.hideMode - } + NComboBox { + Layout.fillWidth: true + label: I18n.tr("bar.taskbar.hide-mode-label") + description: I18n.tr("bar.active-window.hide-mode-description") + model: [ + { + "key": "visible", + "name": I18n.tr("hide-modes.visible") + }, + { + "key": "hidden", + "name": I18n.tr("hide-modes.hidden") + }, + { + "key": "transparent", + "name": I18n.tr("hide-modes.transparent") + } + ] + currentKey: root.valueHideMode + onSelected: key => { + root.valueHideMode = key; + saveSettings(); + } + defaultValue: widgetMetadata.hideMode + } - NColorChoice { - label: I18n.tr("common.select-color") - currentKey: valueTextColor - onSelected: key => { - valueTextColor = key; - saveSettings(); - } - defaultValue: widgetMetadata.textColor - } + NColorChoice { + label: I18n.tr("common.select-color") + currentKey: valueTextColor + onSelected: key => { + valueTextColor = key; + saveSettings(); + } + 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-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") - description: I18n.tr("bar.active-window.show-app-icon-description") - checked: root.valueShowIcon - onToggled: checked => { - root.valueShowIcon = checked; - saveSettings(); - } - defaultValue: widgetMetadata.showIcon - } + NToggle { + Layout.fillWidth: true + label: I18n.tr("bar.active-window.show-app-icon-label") + description: I18n.tr("bar.active-window.show-app-icon-description") + checked: root.valueShowIcon + onToggled: checked => { + root.valueShowIcon = checked; + saveSettings(); + } + defaultValue: widgetMetadata.showIcon + } - NToggle { - Layout.fillWidth: true - label: I18n.tr("bar.tray.colorize-icons-label") - description: I18n.tr("bar.active-window.colorize-icons-description") - checked: root.valueColorizeIcons - onToggled: checked => { - root.valueColorizeIcons = checked; - saveSettings(); - } - visible: root.valueShowIcon - defaultValue: widgetMetadata.colorizeIcons - } + NToggle { + Layout.fillWidth: true + label: I18n.tr("bar.tray.colorize-icons-label") + description: I18n.tr("bar.active-window.colorize-icons-description") + checked: root.valueColorizeIcons + onToggled: checked => { + root.valueColorizeIcons = checked; + saveSettings(); + } + visible: root.valueShowIcon + defaultValue: widgetMetadata.colorizeIcons + } - NTextInput { - id: widthInput - Layout.fillWidth: true - label: I18n.tr("bar.taskbar.max-width-label") - description: I18n.tr("bar.media-mini.max-width-description") - placeholderText: widgetMetadata.maxWidth - text: valueMaxWidth - onTextChanged: saveSettings() - defaultValue: String(widgetMetadata.maxWidth) - } + NTextInput { + id: widthInput + Layout.fillWidth: true + label: I18n.tr("bar.taskbar.max-width-label") + description: I18n.tr("bar.media-mini.max-width-description") + placeholderText: widgetMetadata.maxWidth + text: valueMaxWidth + onTextChanged: saveSettings() + defaultValue: String(widgetMetadata.maxWidth) + } - NToggle { - Layout.fillWidth: true - label: I18n.tr("bar.media-mini.use-fixed-width-label") - description: I18n.tr("bar.media-mini.use-fixed-width-description") - checked: valueUseFixedWidth - onToggled: checked => { - valueUseFixedWidth = checked; - saveSettings(); - } - defaultValue: widgetMetadata.useFixedWidth - } + NToggle { + Layout.fillWidth: true + label: I18n.tr("bar.media-mini.use-fixed-width-label") + description: I18n.tr("bar.media-mini.use-fixed-width-description") + checked: valueUseFixedWidth + onToggled: checked => { + valueUseFixedWidth = checked; + saveSettings(); + } + defaultValue: widgetMetadata.useFixedWidth + } - NComboBox { - label: I18n.tr("bar.media-mini.scrolling-mode-label") - description: I18n.tr("bar.active-window.scrolling-mode-description") - model: [ - { - "key": "always", - "name": I18n.tr("options.scrolling-modes.always") - }, - { - "key": "hover", - "name": I18n.tr("options.scrolling-modes.hover") - }, - { - "key": "never", - "name": I18n.tr("options.scrolling-modes.never") - } - ] - currentKey: valueScrollingMode - defaultValue: widgetMetadata.scrollingMode - onSelected: key => { - valueScrollingMode = key; - saveSettings(); - } - minimumWidth: 200 - } + NComboBox { + label: I18n.tr("bar.media-mini.scrolling-mode-label") + description: I18n.tr("bar.active-window.scrolling-mode-description") + model: [ + { + "key": "always", + "name": I18n.tr("options.scrolling-modes.always") + }, + { + "key": "hover", + "name": I18n.tr("options.scrolling-modes.hover") + }, + { + "key": "never", + "name": I18n.tr("options.scrolling-modes.never") + } + ] + currentKey: valueScrollingMode + defaultValue: widgetMetadata.scrollingMode + onSelected: key => { + valueScrollingMode = key; + saveSettings(); + } + minimumWidth: 200 + } } From c82414047191351d6b859cc7276c7bda7a8c46a2 Mon Sep 17 00:00:00 2001 From: Corey Woodworth <8398380+MrDowntempo@users.noreply.github.com> Date: Tue, 31 Mar 2026 13:12:22 -0400 Subject: [PATCH 5/6] fix: Add showText to BarWidgetRegistry and settings-widgets-default --- Assets/settings-widgets-default.json | 5 +- Services/UI/BarWidgetRegistry.qml | 959 ++++++++++++++------------- 2 files changed, 483 insertions(+), 481 deletions(-) diff --git a/Assets/settings-widgets-default.json b/Assets/settings-widgets-default.json index d810117ff..eeb2c07a7 100644 --- a/Assets/settings-widgets-default.json +++ b/Assets/settings-widgets-default.json @@ -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" } } -} \ No newline at end of file +} diff --git a/Services/UI/BarWidgetRegistry.qml b/Services/UI/BarWidgetRegistry.qml index 2c0461da0..ba40372ed 100644 --- a/Services/UI/BarWidgetRegistry.qml +++ b/Services/UI/BarWidgetRegistry.qml @@ -6,497 +6,498 @@ import qs.Commons import qs.Modules.Bar.Widgets Singleton { - id: root + id: root - signal pluginWidgetRegistryUpdated + signal pluginWidgetRegistryUpdated - // Widget registry object mapping widget names to components - property var widgets: ({ - "ActiveWindow": activeWindowComponent, - "AudioVisualizer": audioVisualizerComponent, - "Battery": batteryComponent, - "Bluetooth": bluetoothComponent, - "Brightness": brightnessComponent, - "Clock": clockComponent, - "ControlCenter": controlCenterComponent, - "CustomButton": customButtonComponent, - "DarkMode": darkModeComponent, - "KeepAwake": keepAwakeComponent, - "KeyboardLayout": keyboardLayoutComponent, - "LockKeys": lockKeysComponent, - "Launcher": launcherComponent, - "MediaMini": mediaMiniComponent, - "Microphone": microphoneComponent, - "Network": networkComponent, - "NightLight": nightLightComponent, - "NoctaliaPerformance": noctaliaPerformanceComponent, - "NotificationHistory": notificationHistoryComponent, - "PowerProfile": powerProfileComponent, - "SessionMenu": sessionMenuComponent, - "Settings": settingsComponent, - "Spacer": spacerComponent, - "SystemMonitor": systemMonitorComponent, - "Taskbar": taskbarComponent, - "Tray": trayComponent, - "Volume": volumeComponent, - "VPN": vpnComponent, - "WallpaperSelector": wallpaperSelectorComponent, - "Workspace": workspaceComponent - }) + // Widget registry object mapping widget names to components + property var widgets: ({ + "ActiveWindow": activeWindowComponent, + "AudioVisualizer": audioVisualizerComponent, + "Battery": batteryComponent, + "Bluetooth": bluetoothComponent, + "Brightness": brightnessComponent, + "Clock": clockComponent, + "ControlCenter": controlCenterComponent, + "CustomButton": customButtonComponent, + "DarkMode": darkModeComponent, + "KeepAwake": keepAwakeComponent, + "KeyboardLayout": keyboardLayoutComponent, + "LockKeys": lockKeysComponent, + "Launcher": launcherComponent, + "MediaMini": mediaMiniComponent, + "Microphone": microphoneComponent, + "Network": networkComponent, + "NightLight": nightLightComponent, + "NoctaliaPerformance": noctaliaPerformanceComponent, + "NotificationHistory": notificationHistoryComponent, + "PowerProfile": powerProfileComponent, + "SessionMenu": sessionMenuComponent, + "Settings": settingsComponent, + "Spacer": spacerComponent, + "SystemMonitor": systemMonitorComponent, + "Taskbar": taskbarComponent, + "Tray": trayComponent, + "Volume": volumeComponent, + "VPN": vpnComponent, + "WallpaperSelector": wallpaperSelectorComponent, + "Workspace": workspaceComponent + }) - property var widgetSettingsMap: ({ - "ActiveWindow": "WidgetSettings/ActiveWindowSettings.qml", - "AudioVisualizer": "WidgetSettings/AudioVisualizerSettings.qml", - "Battery": "WidgetSettings/BatterySettings.qml", - "Bluetooth": "WidgetSettings/BluetoothSettings.qml", - "Brightness": "WidgetSettings/BrightnessSettings.qml", - "Clock": "WidgetSettings/ClockSettings.qml", - "ControlCenter": "WidgetSettings/ControlCenterSettings.qml", - "CustomButton": "WidgetSettings/CustomButtonSettings.qml", - "DarkMode": "WidgetSettings/DarkModeSettings.qml", - "KeepAwake": "WidgetSettings/KeepAwakeSettings.qml", - "KeyboardLayout": "WidgetSettings/KeyboardLayoutSettings.qml", - "Launcher": "WidgetSettings/LauncherSettings.qml", - "LockKeys": "WidgetSettings/LockKeysSettings.qml", - "MediaMini": "WidgetSettings/MediaMiniSettings.qml", - "Microphone": "WidgetSettings/MicrophoneSettings.qml", - "Network": "WidgetSettings/NetworkSettings.qml", - "NightLight": "WidgetSettings/NightLightSettings.qml", - "NoctaliaPerformance": "WidgetSettings/NoctaliaPerformanceSettings.qml", - "NotificationHistory": "WidgetSettings/NotificationHistorySettings.qml", - "PowerProfile": "WidgetSettings/PowerProfileSettings.qml", - "SessionMenu": "WidgetSettings/SessionMenuSettings.qml", - "Settings": "WidgetSettings/SettingsSettings.qml", - "Spacer": "WidgetSettings/SpacerSettings.qml", - "SystemMonitor": "WidgetSettings/SystemMonitorSettings.qml", - "Taskbar": "WidgetSettings/TaskbarSettings.qml", - "Tray": "WidgetSettings/TraySettings.qml", - "Volume": "WidgetSettings/VolumeSettings.qml", - "VPN": "WidgetSettings/VPNSettings.qml", - "WallpaperSelector": "WidgetSettings/WallpaperSelectorSettings.qml", - "Workspace": "WidgetSettings/WorkspaceSettings.qml" - }) + property var widgetSettingsMap: ({ + "ActiveWindow": "WidgetSettings/ActiveWindowSettings.qml", + "AudioVisualizer": "WidgetSettings/AudioVisualizerSettings.qml", + "Battery": "WidgetSettings/BatterySettings.qml", + "Bluetooth": "WidgetSettings/BluetoothSettings.qml", + "Brightness": "WidgetSettings/BrightnessSettings.qml", + "Clock": "WidgetSettings/ClockSettings.qml", + "ControlCenter": "WidgetSettings/ControlCenterSettings.qml", + "CustomButton": "WidgetSettings/CustomButtonSettings.qml", + "DarkMode": "WidgetSettings/DarkModeSettings.qml", + "KeepAwake": "WidgetSettings/KeepAwakeSettings.qml", + "KeyboardLayout": "WidgetSettings/KeyboardLayoutSettings.qml", + "Launcher": "WidgetSettings/LauncherSettings.qml", + "LockKeys": "WidgetSettings/LockKeysSettings.qml", + "MediaMini": "WidgetSettings/MediaMiniSettings.qml", + "Microphone": "WidgetSettings/MicrophoneSettings.qml", + "Network": "WidgetSettings/NetworkSettings.qml", + "NightLight": "WidgetSettings/NightLightSettings.qml", + "NoctaliaPerformance": "WidgetSettings/NoctaliaPerformanceSettings.qml", + "NotificationHistory": "WidgetSettings/NotificationHistorySettings.qml", + "PowerProfile": "WidgetSettings/PowerProfileSettings.qml", + "SessionMenu": "WidgetSettings/SessionMenuSettings.qml", + "Settings": "WidgetSettings/SettingsSettings.qml", + "Spacer": "WidgetSettings/SpacerSettings.qml", + "SystemMonitor": "WidgetSettings/SystemMonitorSettings.qml", + "Taskbar": "WidgetSettings/TaskbarSettings.qml", + "Tray": "WidgetSettings/TraySettings.qml", + "Volume": "WidgetSettings/VolumeSettings.qml", + "VPN": "WidgetSettings/VPNSettings.qml", + "WallpaperSelector": "WidgetSettings/WallpaperSelectorSettings.qml", + "Workspace": "WidgetSettings/WorkspaceSettings.qml" + }) - property var widgetMetadata: ({ - "ActiveWindow": { - "showIcon": true, - "hideMode": "hidden", - "scrollingMode": "hover", - "maxWidth": 145, - "useFixedWidth": false, - "colorizeIcons": false, - "textColor": "none" - }, - "AudioVisualizer": { - "width": 200, - "colorName": "primary", - "hideWhenIdle": false - }, - "Battery": { - "displayMode": "graphic-clean", - "deviceNativePath": "__default__", - "showPowerProfiles": false, - "showNoctaliaPerformance": false, - "hideIfNotDetected": true, - "hideIfIdle": false - }, - "Bluetooth": { - "displayMode": "onhover", - "iconColor": "none", - "textColor": "none" - }, - "Brightness": { - "displayMode": "onhover", - "iconColor": "none", - "textColor": "none", - "applyToAllMonitors": false - }, - "Clock": { - "clockColor": "none", - "useCustomFont": false, - "customFont": "", - "formatHorizontal": "HH:mm ddd, MMM dd", - "formatVertical": "HH mm - dd MM", - "tooltipFormat": "HH:mm ddd, MMM dd" - }, - "ControlCenter": { - "useDistroLogo": false, - "icon": "noctalia", - "customIconPath": "", - "colorizeDistroLogo": false, - "colorizeSystemIcon": "none", - "enableColorization": false - }, - "CustomButton": { - "icon": "heart", - "showIcon": true, - "showExecTooltip": true, - "showTextTooltip": true, - "generalTooltipText": "", - "hideMode": "alwaysExpanded", - "leftClickExec": "", - "leftClickUpdateText": false, - "rightClickExec": "", - "rightClickUpdateText": false, - "middleClickExec": "", - "middleClickUpdateText": false, - "textCommand": "", - "textStream": false, - "textIntervalMs": 3000, - "textCollapse": "", - "parseJson": false, - "wheelExec": "", - "wheelUpExec": "", - "wheelDownExec": "", - "wheelMode": "unified", - "wheelUpdateText": false, - "wheelUpUpdateText": false, - "wheelDownUpdateText": false, - "maxTextLength": { - "horizontal": 10, - "vertical": 10 - }, - "enableColorization": false, - "colorizeSystemIcon": "none", - "ipcIdentifier": "" - }, - "DarkMode": { - "iconColor": "none" - }, - "KeepAwake": { - "iconColor": "none", - "textColor": "none" - }, - "KeyboardLayout": { - "displayMode": "onhover", - "showIcon": true, - "iconColor": "none", - "textColor": "none" - }, - "LockKeys": { - "showCapsLock": true, - "showNumLock": true, - "showScrollLock": true, - "capsLockIcon": "letter-c", - "numLockIcon": "letter-n", - "scrollLockIcon": "letter-s", - "hideWhenOff": false - }, - "Launcher": { - "useDistroLogo": false, - "icon": "rocket", - "customIconPath": "", - "colorizeSystemIcon": "none", - "enableColorization": false, - "iconColor": "none" - }, - "MediaMini": { - "hideMode": "hidden", - "scrollingMode": "hover", - "maxWidth": 145, - "useFixedWidth": false, - "hideWhenIdle": false, - "showAlbumArt": true, - "showArtistFirst": true, - "showVisualizer": false, - "showProgressRing": true, - "visualizerType": "linear", - "textColor": "none", - "compactMode": false, - "panelShowAlbumArt": true - }, - "Microphone": { - "displayMode": "onhover", - "middleClickCommand": "pwvucontrol || pavucontrol", - "iconColor": "none", - "textColor": "none" - }, - "NotificationHistory": { - "showUnreadBadge": true, - "hideWhenZero": false, - "hideWhenZeroUnread": false, - "unreadBadgeColor": "primary", - "iconColor": "none" - }, - "SessionMenu": { - "iconColor": "error" - }, - "Settings": { - "iconColor": "none" - }, - "Spacer": { - "width": 20 - }, - "SystemMonitor": { - "compactMode": true, - "iconColor": "none", - "textColor": "none", - "useMonospaceFont": true, - "usePadding": false, - "showCpuUsage": true, - "showCpuCores": false, - "showCpuFreq": false, - "showCpuTemp": true, - "showGpuTemp": false, - "showLoadAverage": false, - "showMemoryUsage": true, - "showMemoryAsPercent": false, - "showSwapUsage": false, - "showNetworkStats": false, - "showDiskUsage": false, - "showDiskUsageAsPercent": false, - "showDiskAvailable": false, - "diskPath": "/" - }, - "Taskbar": { - "onlySameOutput": true, - "onlyActiveWorkspaces": true, - "hideMode": "hidden", - "colorizeIcons": false, - "showTitle": false, - "titleWidth": 120, - "showPinnedApps": true, - "smartWidth": true, - "maxTaskbarWidth": 40, - "iconScale": 0.8 - }, - "Tray": { - "blacklist": [], - "colorizeIcons": false, - "chevronColor": "none", - "pinned": [], - "drawerEnabled": true, - "hidePassive": false - }, - "VPN": { - "displayMode": "onhover", - "iconColor": "none", - "textColor": "none" - }, - "Network": { - "displayMode": "onhover", - "iconColor": "none", - "textColor": "none" - }, - "NightLight": { - "iconColor": "none" - }, - "NoctaliaPerformance": { - "iconColor": "none" - }, - "PowerProfile": { - "iconColor": "none" - }, - "Workspace": { - "labelMode": "index", - "followFocusedScreen": false, - "hideUnoccupied": false, - "characterCount": 2, - "showApplications": false, - "showApplicationsHover": false, - "showLabelsOnlyWhenOccupied": true, - "colorizeIcons": false, - "unfocusedIconsOpacity": 1.0, - "groupedBorderOpacity": 1.0, - "enableScrollWheel": true, - "iconScale": 0.8, - "focusedColor": "primary", - "occupiedColor": "secondary", - "emptyColor": "secondary", - "showBadge": true, - "pillSize": 0.6, - "fontWeight": "bold" - }, - "Volume": { - "displayMode": "onhover", - "middleClickCommand": "pwvucontrol || pavucontrol", - "iconColor": "none", - "textColor": "none" - }, - "WallpaperSelector": { - "iconColor": "none" - } - }) + property var widgetMetadata: ({ + "ActiveWindow": { + "showText": true, + "showIcon": true, + "hideMode": "hidden", + "scrollingMode": "hover", + "maxWidth": 145, + "useFixedWidth": false, + "colorizeIcons": false, + "textColor": "none" + }, + "AudioVisualizer": { + "width": 200, + "colorName": "primary", + "hideWhenIdle": false + }, + "Battery": { + "displayMode": "graphic-clean", + "deviceNativePath": "__default__", + "showPowerProfiles": false, + "showNoctaliaPerformance": false, + "hideIfNotDetected": true, + "hideIfIdle": false + }, + "Bluetooth": { + "displayMode": "onhover", + "iconColor": "none", + "textColor": "none" + }, + "Brightness": { + "displayMode": "onhover", + "iconColor": "none", + "textColor": "none", + "applyToAllMonitors": false + }, + "Clock": { + "clockColor": "none", + "useCustomFont": false, + "customFont": "", + "formatHorizontal": "HH:mm ddd, MMM dd", + "formatVertical": "HH mm - dd MM", + "tooltipFormat": "HH:mm ddd, MMM dd" + }, + "ControlCenter": { + "useDistroLogo": false, + "icon": "noctalia", + "customIconPath": "", + "colorizeDistroLogo": false, + "colorizeSystemIcon": "none", + "enableColorization": false + }, + "CustomButton": { + "icon": "heart", + "showIcon": true, + "showExecTooltip": true, + "showTextTooltip": true, + "generalTooltipText": "", + "hideMode": "alwaysExpanded", + "leftClickExec": "", + "leftClickUpdateText": false, + "rightClickExec": "", + "rightClickUpdateText": false, + "middleClickExec": "", + "middleClickUpdateText": false, + "textCommand": "", + "textStream": false, + "textIntervalMs": 3000, + "textCollapse": "", + "parseJson": false, + "wheelExec": "", + "wheelUpExec": "", + "wheelDownExec": "", + "wheelMode": "unified", + "wheelUpdateText": false, + "wheelUpUpdateText": false, + "wheelDownUpdateText": false, + "maxTextLength": { + "horizontal": 10, + "vertical": 10 + }, + "enableColorization": false, + "colorizeSystemIcon": "none", + "ipcIdentifier": "" + }, + "DarkMode": { + "iconColor": "none" + }, + "KeepAwake": { + "iconColor": "none", + "textColor": "none" + }, + "KeyboardLayout": { + "displayMode": "onhover", + "showIcon": true, + "iconColor": "none", + "textColor": "none" + }, + "LockKeys": { + "showCapsLock": true, + "showNumLock": true, + "showScrollLock": true, + "capsLockIcon": "letter-c", + "numLockIcon": "letter-n", + "scrollLockIcon": "letter-s", + "hideWhenOff": false + }, + "Launcher": { + "useDistroLogo": false, + "icon": "rocket", + "customIconPath": "", + "colorizeSystemIcon": "none", + "enableColorization": false, + "iconColor": "none" + }, + "MediaMini": { + "hideMode": "hidden", + "scrollingMode": "hover", + "maxWidth": 145, + "useFixedWidth": false, + "hideWhenIdle": false, + "showAlbumArt": true, + "showArtistFirst": true, + "showVisualizer": false, + "showProgressRing": true, + "visualizerType": "linear", + "textColor": "none", + "compactMode": false, + "panelShowAlbumArt": true + }, + "Microphone": { + "displayMode": "onhover", + "middleClickCommand": "pwvucontrol || pavucontrol", + "iconColor": "none", + "textColor": "none" + }, + "NotificationHistory": { + "showUnreadBadge": true, + "hideWhenZero": false, + "hideWhenZeroUnread": false, + "unreadBadgeColor": "primary", + "iconColor": "none" + }, + "SessionMenu": { + "iconColor": "error" + }, + "Settings": { + "iconColor": "none" + }, + "Spacer": { + "width": 20 + }, + "SystemMonitor": { + "compactMode": true, + "iconColor": "none", + "textColor": "none", + "useMonospaceFont": true, + "usePadding": false, + "showCpuUsage": true, + "showCpuCores": false, + "showCpuFreq": false, + "showCpuTemp": true, + "showGpuTemp": false, + "showLoadAverage": false, + "showMemoryUsage": true, + "showMemoryAsPercent": false, + "showSwapUsage": false, + "showNetworkStats": false, + "showDiskUsage": false, + "showDiskUsageAsPercent": false, + "showDiskAvailable": false, + "diskPath": "/" + }, + "Taskbar": { + "onlySameOutput": true, + "onlyActiveWorkspaces": true, + "hideMode": "hidden", + "colorizeIcons": false, + "showTitle": false, + "titleWidth": 120, + "showPinnedApps": true, + "smartWidth": true, + "maxTaskbarWidth": 40, + "iconScale": 0.8 + }, + "Tray": { + "blacklist": [], + "colorizeIcons": false, + "chevronColor": "none", + "pinned": [], + "drawerEnabled": true, + "hidePassive": false + }, + "VPN": { + "displayMode": "onhover", + "iconColor": "none", + "textColor": "none" + }, + "Network": { + "displayMode": "onhover", + "iconColor": "none", + "textColor": "none" + }, + "NightLight": { + "iconColor": "none" + }, + "NoctaliaPerformance": { + "iconColor": "none" + }, + "PowerProfile": { + "iconColor": "none" + }, + "Workspace": { + "labelMode": "index", + "followFocusedScreen": false, + "hideUnoccupied": false, + "characterCount": 2, + "showApplications": false, + "showApplicationsHover": false, + "showLabelsOnlyWhenOccupied": true, + "colorizeIcons": false, + "unfocusedIconsOpacity": 1.0, + "groupedBorderOpacity": 1.0, + "enableScrollWheel": true, + "iconScale": 0.8, + "focusedColor": "primary", + "occupiedColor": "secondary", + "emptyColor": "secondary", + "showBadge": true, + "pillSize": 0.6, + "fontWeight": "bold" + }, + "Volume": { + "displayMode": "onhover", + "middleClickCommand": "pwvucontrol || pavucontrol", + "iconColor": "none", + "textColor": "none" + }, + "WallpaperSelector": { + "iconColor": "none" + } + }) - // Component definitions - these are loaded once at startup - property Component activeWindowComponent: Component { - ActiveWindow {} - } - property Component audioVisualizerComponent: Component { - AudioVisualizer {} - } - property Component batteryComponent: Component { - Battery {} - } - property Component bluetoothComponent: Component { - Bluetooth {} - } - property Component brightnessComponent: Component { - Brightness {} - } - property Component clockComponent: Component { - Clock {} - } - property Component customButtonComponent: Component { - CustomButton {} - } - property Component darkModeComponent: Component { - DarkMode {} - } - property Component keyboardLayoutComponent: Component { - KeyboardLayout {} - } - property Component keepAwakeComponent: Component { - KeepAwake {} - } - property Component lockKeysComponent: Component { - LockKeys {} - } - property Component launcherComponent: Component { - Launcher {} - } - property Component mediaMiniComponent: Component { - MediaMini {} - } - property Component microphoneComponent: Component { - Microphone {} - } - property Component nightLightComponent: Component { - NightLight {} - } - property Component noctaliaPerformanceComponent: Component { - NoctaliaPerformance {} - } - property Component notificationHistoryComponent: Component { - NotificationHistory {} - } - property Component powerProfileComponent: Component { - PowerProfile {} - } - property Component sessionMenuComponent: Component { - SessionMenu {} - } - property Component settingsComponent: Component { - Settings {} - } - property Component controlCenterComponent: Component { - ControlCenter {} - } - property Component spacerComponent: Component { - Spacer {} - } - property Component systemMonitorComponent: Component { - SystemMonitor {} - } - property Component trayComponent: Component { - Tray {} - } - property Component volumeComponent: Component { - Volume {} - } - property Component vpnComponent: Component { - VPN {} - } - property Component networkComponent: Component { - Network {} - } - property Component wallpaperSelectorComponent: Component { - WallpaperSelector {} - } - property Component workspaceComponent: Component { - Workspace {} - } - property Component taskbarComponent: Component { - Taskbar {} - } - function init() { - Logger.i("BarWidgetRegistry", "Service started"); - } - - // ------------------------------ - // Helper function to get widget component by name - function getWidget(id) { - return widgets[id] || null; - } - - // Helper function to check if widget exists - function hasWidget(id) { - return id in widgets; - } - - // Get list of available widget id - function getAvailableWidgets() { - return Object.keys(widgets); - } - - // Helper function to check if widget has user settings - function widgetHasUserSettings(id) { - return widgetMetadata[id] !== undefined; - } - - // ------------------------------ - // Plugin widget registration - - // Track plugin widgets separately - property var pluginWidgets: ({}) - property var pluginWidgetMetadata: ({}) - - // Register a plugin widget - function registerPluginWidget(pluginId, component, metadata) { - if (!pluginId || !component) { - Logger.e("BarWidgetRegistry", "Cannot register plugin widget: invalid parameters"); - return false; + // Component definitions - these are loaded once at startup + property Component activeWindowComponent: Component { + ActiveWindow {} + } + property Component audioVisualizerComponent: Component { + AudioVisualizer {} + } + property Component batteryComponent: Component { + Battery {} + } + property Component bluetoothComponent: Component { + Bluetooth {} + } + property Component brightnessComponent: Component { + Brightness {} + } + property Component clockComponent: Component { + Clock {} + } + property Component customButtonComponent: Component { + CustomButton {} + } + property Component darkModeComponent: Component { + DarkMode {} + } + property Component keyboardLayoutComponent: Component { + KeyboardLayout {} + } + property Component keepAwakeComponent: Component { + KeepAwake {} + } + property Component lockKeysComponent: Component { + LockKeys {} + } + property Component launcherComponent: Component { + Launcher {} + } + property Component mediaMiniComponent: Component { + MediaMini {} + } + property Component microphoneComponent: Component { + Microphone {} + } + property Component nightLightComponent: Component { + NightLight {} + } + property Component noctaliaPerformanceComponent: Component { + NoctaliaPerformance {} + } + property Component notificationHistoryComponent: Component { + NotificationHistory {} + } + property Component powerProfileComponent: Component { + PowerProfile {} + } + property Component sessionMenuComponent: Component { + SessionMenu {} + } + property Component settingsComponent: Component { + Settings {} + } + property Component controlCenterComponent: Component { + ControlCenter {} + } + property Component spacerComponent: Component { + Spacer {} + } + property Component systemMonitorComponent: Component { + SystemMonitor {} + } + property Component trayComponent: Component { + Tray {} + } + property Component volumeComponent: Component { + Volume {} + } + property Component vpnComponent: Component { + VPN {} + } + property Component networkComponent: Component { + Network {} + } + property Component wallpaperSelectorComponent: Component { + WallpaperSelector {} + } + property Component workspaceComponent: Component { + Workspace {} + } + property Component taskbarComponent: Component { + Taskbar {} + } + function init() { + Logger.i("BarWidgetRegistry", "Service started"); } - // Add plugin: prefix to avoid conflicts with core widgets - var widgetId = "plugin:" + pluginId; - - pluginWidgets[widgetId] = component; - pluginWidgetMetadata[widgetId] = metadata || {}; - - // Also add to main widgets object for unified access - widgets[widgetId] = component; - widgetMetadata[widgetId] = metadata || {}; - - Logger.i("BarWidgetRegistry", "Registered plugin widget:", widgetId); - root.pluginWidgetRegistryUpdated(); - return true; - } - - // Unregister a plugin widget - function unregisterPluginWidget(pluginId) { - var widgetId = "plugin:" + pluginId; - - if (!pluginWidgets[widgetId]) { - Logger.w("BarWidgetRegistry", "Plugin widget not registered:", widgetId); - return false; + // ------------------------------ + // Helper function to get widget component by name + function getWidget(id) { + return widgets[id] || null; } - delete pluginWidgets[widgetId]; - delete pluginWidgetMetadata[widgetId]; - delete widgets[widgetId]; - delete widgetMetadata[widgetId]; + // Helper function to check if widget exists + function hasWidget(id) { + return id in widgets; + } - Logger.i("BarWidgetRegistry", "Unregistered plugin widget:", widgetId); - root.pluginWidgetRegistryUpdated(); - return true; - } + // Get list of available widget id + function getAvailableWidgets() { + return Object.keys(widgets); + } - // Check if a widget is a plugin widget - function isPluginWidget(id) { - return id.startsWith("plugin:"); - } + // Helper function to check if widget has user settings + function widgetHasUserSettings(id) { + return widgetMetadata[id] !== undefined; + } - property var cpuIntensiveWidgets: ["AudioVisualizer"] + // ------------------------------ + // Plugin widget registration - function isCpuIntensive(id) { - if (pluginWidgetMetadata[id]?.cpuIntensive) - return true; - return cpuIntensiveWidgets.indexOf(id) >= 0; - } + // Track plugin widgets separately + property var pluginWidgets: ({}) + property var pluginWidgetMetadata: ({}) - // Get list of plugin widget IDs - function getPluginWidgets() { - return Object.keys(pluginWidgets); - } + // Register a plugin widget + function registerPluginWidget(pluginId, component, metadata) { + if (!pluginId || !component) { + Logger.e("BarWidgetRegistry", "Cannot register plugin widget: invalid parameters"); + return false; + } + + // Add plugin: prefix to avoid conflicts with core widgets + var widgetId = "plugin:" + pluginId; + + pluginWidgets[widgetId] = component; + pluginWidgetMetadata[widgetId] = metadata || {}; + + // Also add to main widgets object for unified access + widgets[widgetId] = component; + widgetMetadata[widgetId] = metadata || {}; + + Logger.i("BarWidgetRegistry", "Registered plugin widget:", widgetId); + root.pluginWidgetRegistryUpdated(); + return true; + } + + // Unregister a plugin widget + function unregisterPluginWidget(pluginId) { + var widgetId = "plugin:" + pluginId; + + if (!pluginWidgets[widgetId]) { + Logger.w("BarWidgetRegistry", "Plugin widget not registered:", widgetId); + return false; + } + + delete pluginWidgets[widgetId]; + delete pluginWidgetMetadata[widgetId]; + delete widgets[widgetId]; + delete widgetMetadata[widgetId]; + + Logger.i("BarWidgetRegistry", "Unregistered plugin widget:", widgetId); + root.pluginWidgetRegistryUpdated(); + return true; + } + + // Check if a widget is a plugin widget + function isPluginWidget(id) { + return id.startsWith("plugin:"); + } + + property var cpuIntensiveWidgets: ["AudioVisualizer"] + + function isCpuIntensive(id) { + if (pluginWidgetMetadata[id]?.cpuIntensive) + return true; + return cpuIntensiveWidgets.indexOf(id) >= 0; + } + + // Get list of plugin widget IDs + function getPluginWidgets() { + return Object.keys(pluginWidgets); + } } From cfad4fc77acc5e7f9112750fc058e9d7a0ef49af Mon Sep 17 00:00:00 2001 From: Corey Woodworth <8398380+MrDowntempo@users.noreply.github.com> Date: Tue, 31 Mar 2026 13:15:41 -0400 Subject: [PATCH 6/6] chore: run qmlfmt.sh again --- Services/UI/BarWidgetRegistry.qml | 960 +++++++++++++++--------------- 1 file changed, 480 insertions(+), 480 deletions(-) diff --git a/Services/UI/BarWidgetRegistry.qml b/Services/UI/BarWidgetRegistry.qml index ba40372ed..5c951d4cc 100644 --- a/Services/UI/BarWidgetRegistry.qml +++ b/Services/UI/BarWidgetRegistry.qml @@ -6,498 +6,498 @@ import qs.Commons import qs.Modules.Bar.Widgets Singleton { - id: root + id: root - signal pluginWidgetRegistryUpdated + signal pluginWidgetRegistryUpdated - // Widget registry object mapping widget names to components - property var widgets: ({ - "ActiveWindow": activeWindowComponent, - "AudioVisualizer": audioVisualizerComponent, - "Battery": batteryComponent, - "Bluetooth": bluetoothComponent, - "Brightness": brightnessComponent, - "Clock": clockComponent, - "ControlCenter": controlCenterComponent, - "CustomButton": customButtonComponent, - "DarkMode": darkModeComponent, - "KeepAwake": keepAwakeComponent, - "KeyboardLayout": keyboardLayoutComponent, - "LockKeys": lockKeysComponent, - "Launcher": launcherComponent, - "MediaMini": mediaMiniComponent, - "Microphone": microphoneComponent, - "Network": networkComponent, - "NightLight": nightLightComponent, - "NoctaliaPerformance": noctaliaPerformanceComponent, - "NotificationHistory": notificationHistoryComponent, - "PowerProfile": powerProfileComponent, - "SessionMenu": sessionMenuComponent, - "Settings": settingsComponent, - "Spacer": spacerComponent, - "SystemMonitor": systemMonitorComponent, - "Taskbar": taskbarComponent, - "Tray": trayComponent, - "Volume": volumeComponent, - "VPN": vpnComponent, - "WallpaperSelector": wallpaperSelectorComponent, - "Workspace": workspaceComponent - }) + // Widget registry object mapping widget names to components + property var widgets: ({ + "ActiveWindow": activeWindowComponent, + "AudioVisualizer": audioVisualizerComponent, + "Battery": batteryComponent, + "Bluetooth": bluetoothComponent, + "Brightness": brightnessComponent, + "Clock": clockComponent, + "ControlCenter": controlCenterComponent, + "CustomButton": customButtonComponent, + "DarkMode": darkModeComponent, + "KeepAwake": keepAwakeComponent, + "KeyboardLayout": keyboardLayoutComponent, + "LockKeys": lockKeysComponent, + "Launcher": launcherComponent, + "MediaMini": mediaMiniComponent, + "Microphone": microphoneComponent, + "Network": networkComponent, + "NightLight": nightLightComponent, + "NoctaliaPerformance": noctaliaPerformanceComponent, + "NotificationHistory": notificationHistoryComponent, + "PowerProfile": powerProfileComponent, + "SessionMenu": sessionMenuComponent, + "Settings": settingsComponent, + "Spacer": spacerComponent, + "SystemMonitor": systemMonitorComponent, + "Taskbar": taskbarComponent, + "Tray": trayComponent, + "Volume": volumeComponent, + "VPN": vpnComponent, + "WallpaperSelector": wallpaperSelectorComponent, + "Workspace": workspaceComponent + }) - property var widgetSettingsMap: ({ - "ActiveWindow": "WidgetSettings/ActiveWindowSettings.qml", - "AudioVisualizer": "WidgetSettings/AudioVisualizerSettings.qml", - "Battery": "WidgetSettings/BatterySettings.qml", - "Bluetooth": "WidgetSettings/BluetoothSettings.qml", - "Brightness": "WidgetSettings/BrightnessSettings.qml", - "Clock": "WidgetSettings/ClockSettings.qml", - "ControlCenter": "WidgetSettings/ControlCenterSettings.qml", - "CustomButton": "WidgetSettings/CustomButtonSettings.qml", - "DarkMode": "WidgetSettings/DarkModeSettings.qml", - "KeepAwake": "WidgetSettings/KeepAwakeSettings.qml", - "KeyboardLayout": "WidgetSettings/KeyboardLayoutSettings.qml", - "Launcher": "WidgetSettings/LauncherSettings.qml", - "LockKeys": "WidgetSettings/LockKeysSettings.qml", - "MediaMini": "WidgetSettings/MediaMiniSettings.qml", - "Microphone": "WidgetSettings/MicrophoneSettings.qml", - "Network": "WidgetSettings/NetworkSettings.qml", - "NightLight": "WidgetSettings/NightLightSettings.qml", - "NoctaliaPerformance": "WidgetSettings/NoctaliaPerformanceSettings.qml", - "NotificationHistory": "WidgetSettings/NotificationHistorySettings.qml", - "PowerProfile": "WidgetSettings/PowerProfileSettings.qml", - "SessionMenu": "WidgetSettings/SessionMenuSettings.qml", - "Settings": "WidgetSettings/SettingsSettings.qml", - "Spacer": "WidgetSettings/SpacerSettings.qml", - "SystemMonitor": "WidgetSettings/SystemMonitorSettings.qml", - "Taskbar": "WidgetSettings/TaskbarSettings.qml", - "Tray": "WidgetSettings/TraySettings.qml", - "Volume": "WidgetSettings/VolumeSettings.qml", - "VPN": "WidgetSettings/VPNSettings.qml", - "WallpaperSelector": "WidgetSettings/WallpaperSelectorSettings.qml", - "Workspace": "WidgetSettings/WorkspaceSettings.qml" - }) + property var widgetSettingsMap: ({ + "ActiveWindow": "WidgetSettings/ActiveWindowSettings.qml", + "AudioVisualizer": "WidgetSettings/AudioVisualizerSettings.qml", + "Battery": "WidgetSettings/BatterySettings.qml", + "Bluetooth": "WidgetSettings/BluetoothSettings.qml", + "Brightness": "WidgetSettings/BrightnessSettings.qml", + "Clock": "WidgetSettings/ClockSettings.qml", + "ControlCenter": "WidgetSettings/ControlCenterSettings.qml", + "CustomButton": "WidgetSettings/CustomButtonSettings.qml", + "DarkMode": "WidgetSettings/DarkModeSettings.qml", + "KeepAwake": "WidgetSettings/KeepAwakeSettings.qml", + "KeyboardLayout": "WidgetSettings/KeyboardLayoutSettings.qml", + "Launcher": "WidgetSettings/LauncherSettings.qml", + "LockKeys": "WidgetSettings/LockKeysSettings.qml", + "MediaMini": "WidgetSettings/MediaMiniSettings.qml", + "Microphone": "WidgetSettings/MicrophoneSettings.qml", + "Network": "WidgetSettings/NetworkSettings.qml", + "NightLight": "WidgetSettings/NightLightSettings.qml", + "NoctaliaPerformance": "WidgetSettings/NoctaliaPerformanceSettings.qml", + "NotificationHistory": "WidgetSettings/NotificationHistorySettings.qml", + "PowerProfile": "WidgetSettings/PowerProfileSettings.qml", + "SessionMenu": "WidgetSettings/SessionMenuSettings.qml", + "Settings": "WidgetSettings/SettingsSettings.qml", + "Spacer": "WidgetSettings/SpacerSettings.qml", + "SystemMonitor": "WidgetSettings/SystemMonitorSettings.qml", + "Taskbar": "WidgetSettings/TaskbarSettings.qml", + "Tray": "WidgetSettings/TraySettings.qml", + "Volume": "WidgetSettings/VolumeSettings.qml", + "VPN": "WidgetSettings/VPNSettings.qml", + "WallpaperSelector": "WidgetSettings/WallpaperSelectorSettings.qml", + "Workspace": "WidgetSettings/WorkspaceSettings.qml" + }) - property var widgetMetadata: ({ - "ActiveWindow": { - "showText": true, - "showIcon": true, - "hideMode": "hidden", - "scrollingMode": "hover", - "maxWidth": 145, - "useFixedWidth": false, - "colorizeIcons": false, - "textColor": "none" - }, - "AudioVisualizer": { - "width": 200, - "colorName": "primary", - "hideWhenIdle": false - }, - "Battery": { - "displayMode": "graphic-clean", - "deviceNativePath": "__default__", - "showPowerProfiles": false, - "showNoctaliaPerformance": false, - "hideIfNotDetected": true, - "hideIfIdle": false - }, - "Bluetooth": { - "displayMode": "onhover", - "iconColor": "none", - "textColor": "none" - }, - "Brightness": { - "displayMode": "onhover", - "iconColor": "none", - "textColor": "none", - "applyToAllMonitors": false - }, - "Clock": { - "clockColor": "none", - "useCustomFont": false, - "customFont": "", - "formatHorizontal": "HH:mm ddd, MMM dd", - "formatVertical": "HH mm - dd MM", - "tooltipFormat": "HH:mm ddd, MMM dd" - }, - "ControlCenter": { - "useDistroLogo": false, - "icon": "noctalia", - "customIconPath": "", - "colorizeDistroLogo": false, - "colorizeSystemIcon": "none", - "enableColorization": false - }, - "CustomButton": { - "icon": "heart", - "showIcon": true, - "showExecTooltip": true, - "showTextTooltip": true, - "generalTooltipText": "", - "hideMode": "alwaysExpanded", - "leftClickExec": "", - "leftClickUpdateText": false, - "rightClickExec": "", - "rightClickUpdateText": false, - "middleClickExec": "", - "middleClickUpdateText": false, - "textCommand": "", - "textStream": false, - "textIntervalMs": 3000, - "textCollapse": "", - "parseJson": false, - "wheelExec": "", - "wheelUpExec": "", - "wheelDownExec": "", - "wheelMode": "unified", - "wheelUpdateText": false, - "wheelUpUpdateText": false, - "wheelDownUpdateText": false, - "maxTextLength": { - "horizontal": 10, - "vertical": 10 - }, - "enableColorization": false, - "colorizeSystemIcon": "none", - "ipcIdentifier": "" - }, - "DarkMode": { - "iconColor": "none" - }, - "KeepAwake": { - "iconColor": "none", - "textColor": "none" - }, - "KeyboardLayout": { - "displayMode": "onhover", - "showIcon": true, - "iconColor": "none", - "textColor": "none" - }, - "LockKeys": { - "showCapsLock": true, - "showNumLock": true, - "showScrollLock": true, - "capsLockIcon": "letter-c", - "numLockIcon": "letter-n", - "scrollLockIcon": "letter-s", - "hideWhenOff": false - }, - "Launcher": { - "useDistroLogo": false, - "icon": "rocket", - "customIconPath": "", - "colorizeSystemIcon": "none", - "enableColorization": false, - "iconColor": "none" - }, - "MediaMini": { - "hideMode": "hidden", - "scrollingMode": "hover", - "maxWidth": 145, - "useFixedWidth": false, - "hideWhenIdle": false, - "showAlbumArt": true, - "showArtistFirst": true, - "showVisualizer": false, - "showProgressRing": true, - "visualizerType": "linear", - "textColor": "none", - "compactMode": false, - "panelShowAlbumArt": true - }, - "Microphone": { - "displayMode": "onhover", - "middleClickCommand": "pwvucontrol || pavucontrol", - "iconColor": "none", - "textColor": "none" - }, - "NotificationHistory": { - "showUnreadBadge": true, - "hideWhenZero": false, - "hideWhenZeroUnread": false, - "unreadBadgeColor": "primary", - "iconColor": "none" - }, - "SessionMenu": { - "iconColor": "error" - }, - "Settings": { - "iconColor": "none" - }, - "Spacer": { - "width": 20 - }, - "SystemMonitor": { - "compactMode": true, - "iconColor": "none", - "textColor": "none", - "useMonospaceFont": true, - "usePadding": false, - "showCpuUsage": true, - "showCpuCores": false, - "showCpuFreq": false, - "showCpuTemp": true, - "showGpuTemp": false, - "showLoadAverage": false, - "showMemoryUsage": true, - "showMemoryAsPercent": false, - "showSwapUsage": false, - "showNetworkStats": false, - "showDiskUsage": false, - "showDiskUsageAsPercent": false, - "showDiskAvailable": false, - "diskPath": "/" - }, - "Taskbar": { - "onlySameOutput": true, - "onlyActiveWorkspaces": true, - "hideMode": "hidden", - "colorizeIcons": false, - "showTitle": false, - "titleWidth": 120, - "showPinnedApps": true, - "smartWidth": true, - "maxTaskbarWidth": 40, - "iconScale": 0.8 - }, - "Tray": { - "blacklist": [], - "colorizeIcons": false, - "chevronColor": "none", - "pinned": [], - "drawerEnabled": true, - "hidePassive": false - }, - "VPN": { - "displayMode": "onhover", - "iconColor": "none", - "textColor": "none" - }, - "Network": { - "displayMode": "onhover", - "iconColor": "none", - "textColor": "none" - }, - "NightLight": { - "iconColor": "none" - }, - "NoctaliaPerformance": { - "iconColor": "none" - }, - "PowerProfile": { - "iconColor": "none" - }, - "Workspace": { - "labelMode": "index", - "followFocusedScreen": false, - "hideUnoccupied": false, - "characterCount": 2, - "showApplications": false, - "showApplicationsHover": false, - "showLabelsOnlyWhenOccupied": true, - "colorizeIcons": false, - "unfocusedIconsOpacity": 1.0, - "groupedBorderOpacity": 1.0, - "enableScrollWheel": true, - "iconScale": 0.8, - "focusedColor": "primary", - "occupiedColor": "secondary", - "emptyColor": "secondary", - "showBadge": true, - "pillSize": 0.6, - "fontWeight": "bold" - }, - "Volume": { - "displayMode": "onhover", - "middleClickCommand": "pwvucontrol || pavucontrol", - "iconColor": "none", - "textColor": "none" - }, - "WallpaperSelector": { - "iconColor": "none" - } - }) + property var widgetMetadata: ({ + "ActiveWindow": { + "showText": true, + "showIcon": true, + "hideMode": "hidden", + "scrollingMode": "hover", + "maxWidth": 145, + "useFixedWidth": false, + "colorizeIcons": false, + "textColor": "none" + }, + "AudioVisualizer": { + "width": 200, + "colorName": "primary", + "hideWhenIdle": false + }, + "Battery": { + "displayMode": "graphic-clean", + "deviceNativePath": "__default__", + "showPowerProfiles": false, + "showNoctaliaPerformance": false, + "hideIfNotDetected": true, + "hideIfIdle": false + }, + "Bluetooth": { + "displayMode": "onhover", + "iconColor": "none", + "textColor": "none" + }, + "Brightness": { + "displayMode": "onhover", + "iconColor": "none", + "textColor": "none", + "applyToAllMonitors": false + }, + "Clock": { + "clockColor": "none", + "useCustomFont": false, + "customFont": "", + "formatHorizontal": "HH:mm ddd, MMM dd", + "formatVertical": "HH mm - dd MM", + "tooltipFormat": "HH:mm ddd, MMM dd" + }, + "ControlCenter": { + "useDistroLogo": false, + "icon": "noctalia", + "customIconPath": "", + "colorizeDistroLogo": false, + "colorizeSystemIcon": "none", + "enableColorization": false + }, + "CustomButton": { + "icon": "heart", + "showIcon": true, + "showExecTooltip": true, + "showTextTooltip": true, + "generalTooltipText": "", + "hideMode": "alwaysExpanded", + "leftClickExec": "", + "leftClickUpdateText": false, + "rightClickExec": "", + "rightClickUpdateText": false, + "middleClickExec": "", + "middleClickUpdateText": false, + "textCommand": "", + "textStream": false, + "textIntervalMs": 3000, + "textCollapse": "", + "parseJson": false, + "wheelExec": "", + "wheelUpExec": "", + "wheelDownExec": "", + "wheelMode": "unified", + "wheelUpdateText": false, + "wheelUpUpdateText": false, + "wheelDownUpdateText": false, + "maxTextLength": { + "horizontal": 10, + "vertical": 10 + }, + "enableColorization": false, + "colorizeSystemIcon": "none", + "ipcIdentifier": "" + }, + "DarkMode": { + "iconColor": "none" + }, + "KeepAwake": { + "iconColor": "none", + "textColor": "none" + }, + "KeyboardLayout": { + "displayMode": "onhover", + "showIcon": true, + "iconColor": "none", + "textColor": "none" + }, + "LockKeys": { + "showCapsLock": true, + "showNumLock": true, + "showScrollLock": true, + "capsLockIcon": "letter-c", + "numLockIcon": "letter-n", + "scrollLockIcon": "letter-s", + "hideWhenOff": false + }, + "Launcher": { + "useDistroLogo": false, + "icon": "rocket", + "customIconPath": "", + "colorizeSystemIcon": "none", + "enableColorization": false, + "iconColor": "none" + }, + "MediaMini": { + "hideMode": "hidden", + "scrollingMode": "hover", + "maxWidth": 145, + "useFixedWidth": false, + "hideWhenIdle": false, + "showAlbumArt": true, + "showArtistFirst": true, + "showVisualizer": false, + "showProgressRing": true, + "visualizerType": "linear", + "textColor": "none", + "compactMode": false, + "panelShowAlbumArt": true + }, + "Microphone": { + "displayMode": "onhover", + "middleClickCommand": "pwvucontrol || pavucontrol", + "iconColor": "none", + "textColor": "none" + }, + "NotificationHistory": { + "showUnreadBadge": true, + "hideWhenZero": false, + "hideWhenZeroUnread": false, + "unreadBadgeColor": "primary", + "iconColor": "none" + }, + "SessionMenu": { + "iconColor": "error" + }, + "Settings": { + "iconColor": "none" + }, + "Spacer": { + "width": 20 + }, + "SystemMonitor": { + "compactMode": true, + "iconColor": "none", + "textColor": "none", + "useMonospaceFont": true, + "usePadding": false, + "showCpuUsage": true, + "showCpuCores": false, + "showCpuFreq": false, + "showCpuTemp": true, + "showGpuTemp": false, + "showLoadAverage": false, + "showMemoryUsage": true, + "showMemoryAsPercent": false, + "showSwapUsage": false, + "showNetworkStats": false, + "showDiskUsage": false, + "showDiskUsageAsPercent": false, + "showDiskAvailable": false, + "diskPath": "/" + }, + "Taskbar": { + "onlySameOutput": true, + "onlyActiveWorkspaces": true, + "hideMode": "hidden", + "colorizeIcons": false, + "showTitle": false, + "titleWidth": 120, + "showPinnedApps": true, + "smartWidth": true, + "maxTaskbarWidth": 40, + "iconScale": 0.8 + }, + "Tray": { + "blacklist": [], + "colorizeIcons": false, + "chevronColor": "none", + "pinned": [], + "drawerEnabled": true, + "hidePassive": false + }, + "VPN": { + "displayMode": "onhover", + "iconColor": "none", + "textColor": "none" + }, + "Network": { + "displayMode": "onhover", + "iconColor": "none", + "textColor": "none" + }, + "NightLight": { + "iconColor": "none" + }, + "NoctaliaPerformance": { + "iconColor": "none" + }, + "PowerProfile": { + "iconColor": "none" + }, + "Workspace": { + "labelMode": "index", + "followFocusedScreen": false, + "hideUnoccupied": false, + "characterCount": 2, + "showApplications": false, + "showApplicationsHover": false, + "showLabelsOnlyWhenOccupied": true, + "colorizeIcons": false, + "unfocusedIconsOpacity": 1.0, + "groupedBorderOpacity": 1.0, + "enableScrollWheel": true, + "iconScale": 0.8, + "focusedColor": "primary", + "occupiedColor": "secondary", + "emptyColor": "secondary", + "showBadge": true, + "pillSize": 0.6, + "fontWeight": "bold" + }, + "Volume": { + "displayMode": "onhover", + "middleClickCommand": "pwvucontrol || pavucontrol", + "iconColor": "none", + "textColor": "none" + }, + "WallpaperSelector": { + "iconColor": "none" + } + }) - // Component definitions - these are loaded once at startup - property Component activeWindowComponent: Component { - ActiveWindow {} - } - property Component audioVisualizerComponent: Component { - AudioVisualizer {} - } - property Component batteryComponent: Component { - Battery {} - } - property Component bluetoothComponent: Component { - Bluetooth {} - } - property Component brightnessComponent: Component { - Brightness {} - } - property Component clockComponent: Component { - Clock {} - } - property Component customButtonComponent: Component { - CustomButton {} - } - property Component darkModeComponent: Component { - DarkMode {} - } - property Component keyboardLayoutComponent: Component { - KeyboardLayout {} - } - property Component keepAwakeComponent: Component { - KeepAwake {} - } - property Component lockKeysComponent: Component { - LockKeys {} - } - property Component launcherComponent: Component { - Launcher {} - } - property Component mediaMiniComponent: Component { - MediaMini {} - } - property Component microphoneComponent: Component { - Microphone {} - } - property Component nightLightComponent: Component { - NightLight {} - } - property Component noctaliaPerformanceComponent: Component { - NoctaliaPerformance {} - } - property Component notificationHistoryComponent: Component { - NotificationHistory {} - } - property Component powerProfileComponent: Component { - PowerProfile {} - } - property Component sessionMenuComponent: Component { - SessionMenu {} - } - property Component settingsComponent: Component { - Settings {} - } - property Component controlCenterComponent: Component { - ControlCenter {} - } - property Component spacerComponent: Component { - Spacer {} - } - property Component systemMonitorComponent: Component { - SystemMonitor {} - } - property Component trayComponent: Component { - Tray {} - } - property Component volumeComponent: Component { - Volume {} - } - property Component vpnComponent: Component { - VPN {} - } - property Component networkComponent: Component { - Network {} - } - property Component wallpaperSelectorComponent: Component { - WallpaperSelector {} - } - property Component workspaceComponent: Component { - Workspace {} - } - property Component taskbarComponent: Component { - Taskbar {} - } - function init() { - Logger.i("BarWidgetRegistry", "Service started"); + // Component definitions - these are loaded once at startup + property Component activeWindowComponent: Component { + ActiveWindow {} + } + property Component audioVisualizerComponent: Component { + AudioVisualizer {} + } + property Component batteryComponent: Component { + Battery {} + } + property Component bluetoothComponent: Component { + Bluetooth {} + } + property Component brightnessComponent: Component { + Brightness {} + } + property Component clockComponent: Component { + Clock {} + } + property Component customButtonComponent: Component { + CustomButton {} + } + property Component darkModeComponent: Component { + DarkMode {} + } + property Component keyboardLayoutComponent: Component { + KeyboardLayout {} + } + property Component keepAwakeComponent: Component { + KeepAwake {} + } + property Component lockKeysComponent: Component { + LockKeys {} + } + property Component launcherComponent: Component { + Launcher {} + } + property Component mediaMiniComponent: Component { + MediaMini {} + } + property Component microphoneComponent: Component { + Microphone {} + } + property Component nightLightComponent: Component { + NightLight {} + } + property Component noctaliaPerformanceComponent: Component { + NoctaliaPerformance {} + } + property Component notificationHistoryComponent: Component { + NotificationHistory {} + } + property Component powerProfileComponent: Component { + PowerProfile {} + } + property Component sessionMenuComponent: Component { + SessionMenu {} + } + property Component settingsComponent: Component { + Settings {} + } + property Component controlCenterComponent: Component { + ControlCenter {} + } + property Component spacerComponent: Component { + Spacer {} + } + property Component systemMonitorComponent: Component { + SystemMonitor {} + } + property Component trayComponent: Component { + Tray {} + } + property Component volumeComponent: Component { + Volume {} + } + property Component vpnComponent: Component { + VPN {} + } + property Component networkComponent: Component { + Network {} + } + property Component wallpaperSelectorComponent: Component { + WallpaperSelector {} + } + property Component workspaceComponent: Component { + Workspace {} + } + property Component taskbarComponent: Component { + Taskbar {} + } + function init() { + Logger.i("BarWidgetRegistry", "Service started"); + } + + // ------------------------------ + // Helper function to get widget component by name + function getWidget(id) { + return widgets[id] || null; + } + + // Helper function to check if widget exists + function hasWidget(id) { + return id in widgets; + } + + // Get list of available widget id + function getAvailableWidgets() { + return Object.keys(widgets); + } + + // Helper function to check if widget has user settings + function widgetHasUserSettings(id) { + return widgetMetadata[id] !== undefined; + } + + // ------------------------------ + // Plugin widget registration + + // Track plugin widgets separately + property var pluginWidgets: ({}) + property var pluginWidgetMetadata: ({}) + + // Register a plugin widget + function registerPluginWidget(pluginId, component, metadata) { + if (!pluginId || !component) { + Logger.e("BarWidgetRegistry", "Cannot register plugin widget: invalid parameters"); + return false; } - // ------------------------------ - // Helper function to get widget component by name - function getWidget(id) { - return widgets[id] || null; + // Add plugin: prefix to avoid conflicts with core widgets + var widgetId = "plugin:" + pluginId; + + pluginWidgets[widgetId] = component; + pluginWidgetMetadata[widgetId] = metadata || {}; + + // Also add to main widgets object for unified access + widgets[widgetId] = component; + widgetMetadata[widgetId] = metadata || {}; + + Logger.i("BarWidgetRegistry", "Registered plugin widget:", widgetId); + root.pluginWidgetRegistryUpdated(); + return true; + } + + // Unregister a plugin widget + function unregisterPluginWidget(pluginId) { + var widgetId = "plugin:" + pluginId; + + if (!pluginWidgets[widgetId]) { + Logger.w("BarWidgetRegistry", "Plugin widget not registered:", widgetId); + return false; } - // Helper function to check if widget exists - function hasWidget(id) { - return id in widgets; - } + delete pluginWidgets[widgetId]; + delete pluginWidgetMetadata[widgetId]; + delete widgets[widgetId]; + delete widgetMetadata[widgetId]; - // Get list of available widget id - function getAvailableWidgets() { - return Object.keys(widgets); - } + Logger.i("BarWidgetRegistry", "Unregistered plugin widget:", widgetId); + root.pluginWidgetRegistryUpdated(); + return true; + } - // Helper function to check if widget has user settings - function widgetHasUserSettings(id) { - return widgetMetadata[id] !== undefined; - } + // Check if a widget is a plugin widget + function isPluginWidget(id) { + return id.startsWith("plugin:"); + } - // ------------------------------ - // Plugin widget registration + property var cpuIntensiveWidgets: ["AudioVisualizer"] - // Track plugin widgets separately - property var pluginWidgets: ({}) - property var pluginWidgetMetadata: ({}) + function isCpuIntensive(id) { + if (pluginWidgetMetadata[id]?.cpuIntensive) + return true; + return cpuIntensiveWidgets.indexOf(id) >= 0; + } - // Register a plugin widget - function registerPluginWidget(pluginId, component, metadata) { - if (!pluginId || !component) { - Logger.e("BarWidgetRegistry", "Cannot register plugin widget: invalid parameters"); - return false; - } - - // Add plugin: prefix to avoid conflicts with core widgets - var widgetId = "plugin:" + pluginId; - - pluginWidgets[widgetId] = component; - pluginWidgetMetadata[widgetId] = metadata || {}; - - // Also add to main widgets object for unified access - widgets[widgetId] = component; - widgetMetadata[widgetId] = metadata || {}; - - Logger.i("BarWidgetRegistry", "Registered plugin widget:", widgetId); - root.pluginWidgetRegistryUpdated(); - return true; - } - - // Unregister a plugin widget - function unregisterPluginWidget(pluginId) { - var widgetId = "plugin:" + pluginId; - - if (!pluginWidgets[widgetId]) { - Logger.w("BarWidgetRegistry", "Plugin widget not registered:", widgetId); - return false; - } - - delete pluginWidgets[widgetId]; - delete pluginWidgetMetadata[widgetId]; - delete widgets[widgetId]; - delete widgetMetadata[widgetId]; - - Logger.i("BarWidgetRegistry", "Unregistered plugin widget:", widgetId); - root.pluginWidgetRegistryUpdated(); - return true; - } - - // Check if a widget is a plugin widget - function isPluginWidget(id) { - return id.startsWith("plugin:"); - } - - property var cpuIntensiveWidgets: ["AudioVisualizer"] - - function isCpuIntensive(id) { - if (pluginWidgetMetadata[id]?.cpuIntensive) - return true; - return cpuIntensiveWidgets.indexOf(id) >= 0; - } - - // Get list of plugin widget IDs - function getPluginWidgets() { - return Object.keys(pluginWidgets); - } + // Get list of plugin widget IDs + function getPluginWidgets() { + return Object.keys(pluginWidgets); + } }