Commit Graph
70 Commits
Author SHA1 Message Date
Alex 5181f84648 fix(sni): prevent use-after-free and infinite retry in Host proxy retry
Store the retry timeout connection in a Host member and disconnect it in
~Host, so a Host destroyed within the retry window no longer invokes the
timeout callback on freed memory. Cap the retries (MAX_RETRIES) so a
watcher that never reappears no longer spins forever every 200ms; reset
the counter on success and when the watcher name vanishes.
2026-07-03 21:39:36 +02:00
Alexis Rouillard fce96987e1 Merge pull request #5028 from JeremieRodon/fix/tray-hide-when-empty
fix(tray): hide module when no items are visible
2026-07-03 20:58:33 +02:00
Alexis Rouillard dfe2d80496 Merge branch 'master' into fix/tray-hide-when-empty 2026-07-03 20:45:10 +02:00
Runxi Yu e37fcee35d fix(sni): ignore name/pixmap updates for custom icons 2026-06-19 05:51:00 +00: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 f6d92fd708 fix(sni): render attention and overlay tray icon assets
Load attention and overlay pixmaps from item properties, watch the
corresponding update signals, and prefer attention artwork while an item is in
NeedsAttention state.

When an item only exports an attention movie asset, fall back to loading that
asset as a static pixbuf so the tray still shows the alert state.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-08 01:42:31 -06: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
Austin Horstman 4c71b2bf9f perf(memory): optimize C++ string operations to reduce heap fragmentation
- Replaced pass-by-value std::string parameters with const std::string&
or std::string_view to prevent SSO overallocations.

- Refactored static mapping functions in UPower to return
std::string_view instead of constructing std::string literals, enabling
perfect cache locality.

- Optimized string concatenation in hot loops (network IPs, inhibitor
lists, sway window marks) by using std::string::append() and
pre-reserving capacity instead of overloaded operator+ which produces
temporary heap instances.

These optimizations reduce high-frequency memory churn and overall heap
fragmentation within the main rendering loops.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-02 22:54:07 -06:00
Alex 47fb21a2c1 chore: upgrade to clang-format@21 2026-02-04 09:24:14 +01:00
peelz 0c3e82219f fix: close sni menu on item destruction 2025-09-16 14:03:45 -04:00
Bahnschrift 800c4b56cc Merge remote-tracking branch 'source/master' 2025-06-18 18:42:23 +10:00
Kaosu d1998de47a add setCustomIcon and try to apply such when ID is known 2025-02-16 14:22:10 +01:00
Kaosu 937b62ea9a add SNI custom icon manager 2025-02-16 14:21:08 +01:00
Bahnschrift cf64b2c88c fix: un-hide tray when new icons are added 2024-12-19 12:29:58 +11:00
Lars-Ragnar A. Haugen 8e8ce0c6bc feat(#3182): style tray icon on hover (#3203) 2024-05-06 10:47:25 +02:00
Cherser-s 65dfabc430 sni: fix passing relative coordinates to dbus methods
Doesn't correctly handle the case with both margin and width/height being set at the same time.
2023-08-25 20:37:16 +03: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
Michael Swiger 2d80d31527 Fix tray icon scaling on multi-display setups 2021-08-16 23:33:29 -07:00
Michael Swiger 4f6a9b1bc2 Fix incorrect tray icon scaling 2021-07-31 18:01:31 -07:00
Aleksei Bavshin a5fe6f40b8 feat(tray): handle Status property
On the `Passive` value of `Status` tray items would be hidden unless
`show-passive-items` is set to true.
On the `NeedsAttention` value of `Status` tray items will have a
`.needs-attention` CSS class.
2021-07-22 08:04:06 -07:00
Aleksei Bavshin 245f7f4b11 feat(tray): handle scroll events 2021-07-22 08:04:05 -07:00
Aleksei Bavshin 84a8f79bbe feat(tray): implement tooltips (text only) for tray items 2021-07-22 08:04:03 -07:00
Aleksei Bavshin 4b6253e810 refactor(tray): infer changed properties from signal name
Comparing two GVariants is too expensive; let's collect the set of
properties updated by each signal and apply them unconditionally.
2021-07-22 08:04:00 -07:00
Aleksei Bavshin 929fc16994 fix(tray): ignore unused WindowId property 2021-07-22 08:01:25 -07:00
Jan Beich c844d7ac2e tray: drop std::filesystem dependency 2020-05-19 10:37:27 +00:00
Guillaume Maudoux 047c2929c1 Use the same StatusNotifierWatcher for all trays 2020-02-19 12:06:35 +01:00
Aleksei Bavshin 01ad3d96d8 fix(tray): pre-create dbusmenu for tray items
It seems that dbusmenu is not ready to display menu immediately and
needs some time to sync data via DBus.
Fixes LIBDBUSMENU-GLIB-CRITICAL: dbusmenu_menuitem_send_about_to_show:
assertion 'DBUSMENU_IS_MENUITEM(mi)' failed.
Also fixes initial render of the menu with layer shell popups support patch.
2019-08-27 00:34:00 -07:00
Aleksei Bavshin 642fd48af1 fix(tray): restore Activate support for compliant SNI implementation
Set ItemIsMenu to true by default because libappindicator supports
neither ItemIsMenu nor Activate method and compiant SNI implementations
are expected to reset the flag during initial property fetch.
To be revisited if anyone finds the implementation that has Activate
but does not set ItemIsMenu.
2019-08-27 00:33:59 -07:00
Alex 340ec7be91 refactor: AModule 2019-06-15 14:57:52 +02:00
Alex f2edc8f965 feat(Watcher): define watcher_id 2019-05-20 11:47:52 +02:00
Alex d2d9db23b5 fix: uninitialized bool 2019-05-17 14:23:52 +02:00
Alex 362c393b1d refactor: try/catch, sigc trackable 2019-05-13 15:15:50 +02:00
Alex 311c34ecbc feat(Bar): handle widget size changes 2019-04-24 12:37:24 +02:00
Alex 8cf19826aa fix(Tray): Unexport on exit 2019-04-19 17:03:46 +02:00
Alex 6ed8f94dab refactor: format code 2019-04-18 17:52:00 +02:00
Alex 6d6df4be00 refactor(sni-item): better way to search in default theme 2019-04-17 22:15:18 +02:00
Alex 346ec68578 refactor: format tray && partial fix for #235 2019-04-17 14:19:04 +02:00
Alex 57c99dc526 refactor(Tray): also search in default theme 2019-04-11 15:28:38 +02:00
Alex 78067462be fix(Tray): icons update 2019-04-11 15:20:39 +02:00
Aleksei Bavshin 5a2b5624dc feat(tray): process tray icon update signals 2019-03-29 18:40:28 -07:00
Aleksei Bavshin 82fcee33b3 refactor(tray): use Gio::DBus bindings in SNI Item class 2019-03-29 18:28:29 -07: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
Robinhuett 29a2ee1744 refactor: Replace all occurencec of gtkmm.h and only use the necessary headers 2019-01-08 21:05:44 +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 ad7400d5ce refactor(ALabel): add interval 2018-11-23 11:57:37 +01:00
Alexis 36652158ad refactor(tray): more cpp binding 2018-11-23 10:46:58 +01:00