Tray: properly filter passive tray icons (#991)

This commit is contained in:
Ly-sec
2025-12-07 13:52:22 +01:00
parent e0db795506
commit e7e612b539
2 changed files with 22 additions and 9 deletions
+7 -1
View File
@@ -89,7 +89,8 @@ Rectangle {
const title = item.tooltipTitle || item.name || item.id || "";
// Skip passive items if hidePassive is enabled
if (root.hidePassive && item.status === SystemTray.Passive) {
// Check if status exists and is Passive (using both enum and numeric comparison for safety)
if (root.hidePassive && item.status !== undefined && (item.status === SystemTray.Passive || item.status === 0)) {
continue;
}
@@ -224,6 +225,11 @@ Rectangle {
}
}
// Watch for hidePassive changes to update filtering immediately
onHidePassiveChanged: {
root.updateFilteredItems();
}
Component.onCompleted: {
root.updateFilteredItems(); // Initial update
}
+15 -8
View File
@@ -73,14 +73,21 @@ SmartPanel {
// Dynamic sizing based on item count
// Show items that are NOT pinned (unpinned items go to drawer)
readonly property var trayValuesAll: (SystemTray.items && SystemTray.items.values) ? SystemTray.items.values : []
readonly property var trayValues: trayValuesAll.filter(function (it) {
// Filter out passive items if hidePassive is enabled
if (root.hidePassive && it.status === SystemTray.Passive) {
return false;
}
// Filter out pinned items (they show in the bar)
return !root.isPinned(it);
})
// Explicitly reference hidePassive to ensure reactivity
readonly property var trayValues: {
var _ = root.hidePassive; // Force dependency tracking
return trayValuesAll.filter(function (it) {
if (!it)
return false;
// Filter out passive items if hidePassive is enabled
// Check if status exists and is Passive (using both enum and numeric comparison for safety)
if (root.hidePassive && it.status !== undefined && (it.status === SystemTray.Passive || it.status === 0)) {
return false;
}
// Filter out pinned items (they show in the bar)
return !root.isPinned(it);
});
}
readonly property int itemCount: trayValues.length
readonly property int maxColumns: 8
readonly property real cellSize: Math.round(Style.capsuleHeight * 0.65)