From 7b14094155a240c600d413d4010c496269c197c5 Mon Sep 17 00:00:00 2001 From: purian23 Date: Wed, 30 Jul 2025 18:25:04 -0400 Subject: [PATCH] Hide system tray widget when empty --- Modules/TopBar/SystemTrayBar.qml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Modules/TopBar/SystemTrayBar.qml b/Modules/TopBar/SystemTrayBar.qml index 449f88ce..ead372f2 100644 --- a/Modules/TopBar/SystemTrayBar.qml +++ b/Modules/TopBar/SystemTrayBar.qml @@ -7,18 +7,21 @@ Rectangle { signal menuRequested(var menu, var item, real x, real y) - width: Math.max(40, systemTrayRow.implicitWidth + Theme.spacingS * 2) + readonly property int calculatedWidth: systemTrayRow.children.length > 1 ? + (systemTrayRow.children.length - 1) * 24 + (systemTrayRow.children.length - 2) * Theme.spacingXS + Theme.spacingS * 2 : 0 + + width: calculatedWidth height: 30 radius: Theme.cornerRadius color: { // Only show background when there are system tray items to display - if (systemTrayRow.children.length === 0) + if (!SystemTray.items || SystemTray.items.length === 0) return "transparent"; const baseColor = Theme.secondaryHover; return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, baseColor.a * Theme.widgetTransparency); } - visible: systemTrayRow.children.length > 0 + visible: SystemTray.items && SystemTray.items.length > 0 Row { id: systemTrayRow