Commit Graph
24 Commits
Author SHA1 Message Date
Alex 66139e4440 fix(tray): stop reorderItems from re-adding items (iterator UAF + double add)
The item-ordering feature made Host::reorderItems() re-run the full
remove/add path over items_ via std::ranges::for_each(on_remove_/on_add_).
This caused two confirmed bugs:

BUG 1 (iterator invalidation / UAF): on_add_ (Tray::onAdd) calls
Host::checkIgnoreList, which erases from items_ while for_each is still
iterating items_, invalidating iterators/pointers. Triggered by a
non-empty ignore-list matching an item with >=2 items present.

BUG 2 (double add): reorderItems runs while an item's Id is resolved in
proxyReady, i.e. before setReady(). It added the not-yet-ready item
(re-parenting its event_box, pushing into Tray::items_, connecting
signal_show/hide), then setReady() -> itemReady -> onAdd added it again:
GTK 'widget already has a parent' critical, duplicate Item* and
signal handlers that accumulated unbounded.

Fixes:
- reorderItems() now only reorders already-added GTK box children via a
  dedicated on_reorder_ callback (Tray::reorderBox), never re-adding or
  removing. reorderBox stable-sorts items_ by order_ and repositions
  children with gtk_box_reorder_child (honouring reverse-direction).
- Tray::onAdd is idempotent (guards against an already-added item) and
  positions the new widget via reorderBox before the ignore-list check.
- signal_show/signal_hide connections are stored per item and
  disconnected in Tray::onRemove; onRemove is a no-op for items that were
  never added.
2026-07-05 10:13:24 +02:00
Alexis Rouillard 8eb7ee46cb Merge pull request #4850 from yangyingchao/master
(sni) be able to control oder of tray items, and clean up sni module based on clang-tidy
2026-07-04 01:43:31 +02:00
yangyingchao c07f8ed0a4 (sni) Be able to control order for system tray items. 2026-07-04 01:35:50 +02:00
Jason Chiu 87a337ecdf Update tray.hpp 2026-07-04 01:31:39 +02:00
Alex 02c20cf339 Merge remote-tracking branch 'origin/master' into agd/ignore-tray-applets
# Conflicts:
#	include/modules/sni/tray.hpp
#	src/modules/sni/host.cpp
#	src/modules/sni/tray.cpp
2026-07-03 22:40:04 +02:00
Alexis Rouillard dfe2d80496 Merge branch 'master' into fix/tray-hide-when-empty 2026-07-03 20:45:10 +02:00
Jérémie Rodon 5c3ec1fd63 fix(tray): hide module when no items are visible
Tray::update() already had logic to hide the module when all child items were passive, but it was only re-run on item add/remove — never on a status change. When the last visible item transitioned to Passive, the item hid itself but the now-empty module remained visible.

Connect Tray to each item's Gtk::EventBox signal_show/signal_hide so update() runs on every visibility transition, and simplify update() to check child->get_visible() directly instead of inspecting the `passive` CSS class. The Tray-level `show-passive-items` read becomes redundant since Item already honours it when deciding its own visibility; remove it along with the now-unused Tray::show_passive_ member.

Fixes: #3721
2026-05-11 22:47:24 +02:00
Austin Horstman 2a748f1a56 fix(sni): delay tray item insertion until proxies are ready
Only add tray widgets after the SNI proxy has finished initializing and the
item has a valid id/category pair.

This also removes invalid items through the host teardown path, refreshes the
tray when item status changes, and avoids calling DBus methods through a null
proxy during early clicks or scroll events.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-08 01:20:15 -06:00
anton 3655d73525 Ignore Tray entries by service name and when dbus properties load 2026-02-08 00:44:14 +00:00
Bahnschrift cf64b2c88c fix: un-hide tray when new icons are added 2024-12-19 12:29:58 +11:00
Viktar Lukashonak 61a6c00c02 Happy clang 2023-03-02 16:57:32 +03:00
Alex f2fcadbf62 refactor: lint 2022-04-06 08:37:19 +02:00
Guillaume Maudoux 047c2929c1 Use the same StatusNotifierWatcher for all trays 2020-02-19 12:06:35 +01:00
Alex 340ec7be91 refactor: AModule 2019-06-15 14:57:52 +02:00
Alex 6ed8f94dab refactor: format code 2019-04-18 17:52:00 +02:00
Alex 346ec68578 refactor: format tray && partial fix for #235 2019-04-17 14:19:04 +02:00
Alex 47142a61ae feat: allow waybar to be positioned on left/right 2019-03-22 12:25:05 +01:00
Alexis 399f61df98 refactor: proper modules destruction 2019-01-13 22:22:22 +01:00
Alexis b554094c7e feat: args && class id 2018-12-18 17:30:54 +01:00
Alexis 1d96d57b75 feat: warn user about stopped endless custom module 2018-12-03 09:35:10 +01:00
Alexis 691fb88057 refactor(modules): const bar 2018-12-01 00:10:41 +01:00
Alexis 0b1b0eb1a7 feat(tray): multiple hosts 2018-11-22 16:20:49 +01:00
Alexis ba79b4d397 refactor(tray): cleanup and fixes 2018-11-22 15:47:23 +01:00
Alexis 0eee8eade7 feat(WIP): tray
feat(wip): tray

feat(wip): tray

feat(WIP): gdbus

feat(WIP): tray
2018-09-02 17:29:16 +02:00