1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-07 14:05:38 -05:00

Hide system tray widget when empty

This commit is contained in:
purian23
2025-07-30 18:25:04 -04:00
parent d8ab38a0af
commit 7b14094155

View File

@@ -7,18 +7,21 @@ Rectangle {
signal menuRequested(var menu, var item, real x, real y) 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 height: 30
radius: Theme.cornerRadius radius: Theme.cornerRadius
color: { color: {
// Only show background when there are system tray items to display // 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"; return "transparent";
const baseColor = Theme.secondaryHover; const baseColor = Theme.secondaryHover;
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, baseColor.a * Theme.widgetTransparency); 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 { Row {
id: systemTrayRow id: systemTrayRow