Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,7 @@ if build_tests
'system_monitor_service',
'taskbar_widget',
'time_format',
'tray_identifier',
'triad_workspace_backend',
'ui_tree_reconciler',
'wayland_toplevels_identity',
Expand Down
2 changes: 1 addition & 1 deletion src/dbus/tray/tray_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2118,7 +2118,7 @@ void TrayService::refreshItemMetadata(const std::string& itemId) {
next.statusNotifierTitle = std::move(statusNotifierTitle);
next.statusNotifierDescription = std::move(statusNotifierDescription);
next.status = get_item_property_string_from(properties, "Status", cur.status);
next.needsAttention = (next.status == "NeedsAttention");
next.needsAttention = (StringUtils::toLower(next.status) == "needsattention");

if (next.itemName == "chrome_status_icon_1" && !next.statusNotifierTitle.empty()) {
next.itemName = next.itemName + "::" + next.statusNotifierTitle;
Expand Down
4 changes: 2 additions & 2 deletions src/shell/bar/widgets/tray_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ void TrayWidget::rebuild(Renderer& renderer) {
m_drawerChevronGlyph.clear();
bool hasDrawerItems = false;
for (const auto& item : m_items) {
if (isHiddenItem(item) || isPinnedItem(item)) {
if (tray::isPassiveStatus(item) || isHiddenItem(item) || isPinnedItem(item)) {
continue;
}
hasDrawerItems = true;
Expand Down Expand Up @@ -581,7 +581,7 @@ void TrayWidget::rebuild(Renderer& renderer) {
Flex* gridRow = nullptr;
std::size_t gridCol = 0;
for (const auto& item : m_items) {
if (isHiddenItem(item)) {
if (tray::isPassiveStatus(item) || isHiddenItem(item)) {
continue;
}
if (m_drawerMode && !isPinnedItem(item)) {
Expand Down
3 changes: 3 additions & 0 deletions src/shell/tray/tray_drawer_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ std::size_t TrayDrawerPanel::visibleItemCount() const {
};
std::size_t visible = 0;
for (const auto& item : m_tray->items()) {
if (tray::isPassiveStatus(item)) {
continue;
}
const bool hidden =
std::ranges::any_of(hiddenLower, [&](const std::string& token) { return tokenMatches(token, item); });
const bool pinned =
Expand Down
2 changes: 2 additions & 0 deletions src/shell/tray/tray_identifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace tray {

inline bool isUniqueBusName(std::string_view value) { return !value.empty() && value.front() == ':'; }

inline bool isPassiveStatus(const TrayItemInfo& item) { return StringUtils::toLower(item.status) == "passive"; }

inline bool isTransientUniqueIdentifier(std::string_view value) {
return isUniqueBusName(value) || value.contains("/:");
}
Expand Down
22 changes: 22 additions & 0 deletions tests/tray_identifier_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "shell/tray/tray_identifier.h"

#include <cassert>

int main() {
TrayItemInfo item;

item.status = "Passive";
assert(tray::isPassiveStatus(item));

item.status = "passive";
assert(tray::isPassiveStatus(item));

item.status = "Active";
assert(!tray::isPassiveStatus(item));

item.status = "NeedsAttention";
assert(!tray::isPassiveStatus(item));

item.status.clear();
assert(!tray::isPassiveStatus(item));
}