From 7343d2403a591af40b113d5ec34e8cd8bb4bfb52 Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Wed, 15 Oct 2025 07:41:07 -0400 Subject: [PATCH] Taskbar: minor cleanup + autoformat! --- Modules/Bar/Widgets/Taskbar.qml | 33 +++++++++++++------ .../Bar/WidgetSettings/TaskbarSettings.qml | 2 +- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/Modules/Bar/Widgets/Taskbar.qml b/Modules/Bar/Widgets/Taskbar.qml index 5308e2dc..3d519dfc 100644 --- a/Modules/Bar/Widgets/Taskbar.qml +++ b/Modules/Bar/Widgets/Taskbar.qml @@ -34,16 +34,17 @@ Rectangle { return {} } - readonly property string hideMode: (widgetSettings.hideMode !== undefined) ? widgetSettings.hideMode : widgetMetadata.hideMode - property bool hasWindow: false - readonly property bool onlySameOutput: (widgetSettings.onlySameOutput !== undefined) ? widgetSettings.onlySameOutput : (widgetMetadata.onlySameOutput !== undefined ? widgetMetadata.onlySameOutput : false) - readonly property bool onlyActiveWorkspaces: (widgetSettings.onlyActiveWorkspaces !== undefined) ? widgetSettings.onlyActiveWorkspaces : (widgetMetadata.onlyActiveWorkspaces !== undefined ? widgetMetadata.onlyActiveWorkspaces : false) + readonly property string hideMode: (widgetSettings.hideMode !== undefined) ? widgetSettings.hideMode : widgetMetadata.hideMode + readonly property bool onlySameOutput: (widgetSettings.onlySameOutput !== undefined) ? widgetSettings.onlySameOutput : widgetMetadata.onlySameOutput + readonly property bool onlyActiveWorkspaces: (widgetSettings.onlyActiveWorkspaces !== undefined) ? widgetSettings.onlyActiveWorkspaces : widgetMetadata.onlyActiveWorkspaces function updateHasWindow() { try { var total = CompositorService.windows.count || 0 - var activeIds = CompositorService.getActiveWorkspaces().map(function(ws) { return ws.id }) + var activeIds = CompositorService.getActiveWorkspaces().map(function (ws) { + return ws.id + }) var found = false for (var i = 0; i < total; i++) { var w = CompositorService.windows.get(i) @@ -62,18 +63,28 @@ Rectangle { } } - Component.onCompleted: updateHasWindow() Connections { target: CompositorService - function onWindowListChanged() { updateHasWindow() } - function onWorkspaceChanged() { updateHasWindow() } + function onWindowListChanged() { + updateHasWindow() + } + function onWorkspaceChanged() { + updateHasWindow() + } } + + Component.onCompleted: updateHasWindow() onScreenChanged: updateHasWindow() // "visible": Always Visible, "hidden": Hide When Empty, "transparent": Transparent When Empty visible: hideMode !== "hidden" || hasWindow opacity: (hideMode !== "transparent" || hasWindow) ? 1.0 : 0 - Behavior on opacity { NumberAnimation { duration: Style.animationNormal; easing.type: Easing.OutCubic } } + Behavior on opacity { + NumberAnimation { + duration: Style.animationNormal + easing.type: Easing.OutCubic + } + } implicitWidth: visible ? (isVerticalBar ? Style.capsuleHeight : Math.round(taskbarLayout.implicitWidth + Style.marginM * 2)) : 0 implicitHeight: visible ? (isVerticalBar ? Math.round(taskbarLayout.implicitHeight + Style.marginM * 2) : Style.capsuleHeight) : 0 @@ -104,7 +115,9 @@ Rectangle { required property var modelData property ShellScreen screen: root.screen - visible: (!onlySameOutput || modelData.output == screen.name) && (!onlyActiveWorkspaces || CompositorService.getActiveWorkspaces().map(function(ws){ return ws.id }).includes(modelData.workspaceId)) + visible: (!onlySameOutput || modelData.output == screen.name) && (!onlyActiveWorkspaces || CompositorService.getActiveWorkspaces().map(function (ws) { + return ws.id + }).includes(modelData.workspaceId)) Layout.preferredWidth: root.itemSize Layout.preferredHeight: root.itemSize diff --git a/Modules/Settings/Bar/WidgetSettings/TaskbarSettings.qml b/Modules/Settings/Bar/WidgetSettings/TaskbarSettings.qml index a99fec68..9ea560e8 100644 --- a/Modules/Settings/Bar/WidgetSettings/TaskbarSettings.qml +++ b/Modules/Settings/Bar/WidgetSettings/TaskbarSettings.qml @@ -14,7 +14,7 @@ ColumnLayout { property var widgetMetadata: null // Local state - property string valueHideMode: "hidden" + property string valueHideMode: "hidden" property bool valueOnlyActiveWorkspaces: widgetData.onlyActiveWorkspaces !== undefined ? widgetData.onlyActiveWorkspaces : widgetMetadata.onlyActiveWorkspaces property bool valueOnlySameOutput: widgetData.onlySameOutput !== undefined ? widgetData.onlySameOutput : widgetMetadata.onlySameOutput property bool valueColorizeIcons: widgetData.colorizeIcons !== undefined ? widgetData.colorizeIcons : widgetMetadata.colorizeIcons