wayscriber icon indicating copy to clipboard operation
wayscriber copied to clipboard

[BUG] Tray drawer freezes shell on every open when an item's IconThemePath is a large directory

Open narayanls opened this issue 1 month ago • 3 comments

What happened?

Opening the tray drawer freezes the whole shell for ~500 ms on every click, and up to ~20 s on the first open after boot.

Possible Cause One tray item (wayscriber) reports IconThemePath = /usr/share/icons. TrayWidget::resolveFromTrayThemePath() recursively walks that directory to build an icon index. The drawer creates a new TrayWidget on each open and destroys it in TrayDrawerPanel::onClose(), so the index is lost and the full walk repeats on every open, synchronously on the main loop.

Workaround Pinning the item to the bar (pinned = ["wayscriber"]) takes it out of the drawer, and the drawer then opens instantly.

Suggestion (according to Claude IA) Cache the IconThemePath index outside the widget (e.g. in the tray service, keyed by path), or build it off the main loop, so that one misbehaving tray item can't stall the shell.

Steps to reproduce

  1. Install wayscriber from AUR in Niri or Umbriel
  2. Use widget tray icons with drawer
  3. Click to open tray icons in the bar

Diagnostics

Wayscriber 0.9.26 (commit 22dc33e, built 2026-10-13)
Install source: unknown
Desktop: umbriel
Wayland display: wayland-0
Features: dbus, portal, tray, toolbar-gtk, tablet-input

Compositor / desktop

Niri

How did you install Wayscriber?

AUR

Logs (optional)

**Version:** Noctalia 5.3.0 (CachyOS, tested on both Niri and Umbriel)

surface prepareFrame callback took 494.1ms (…, 140x60 logical)
surface prepareFrame callback took 20468.7ms (…, 140x60 logical)   # first open after boot

`strace -c` during a single drawer open: 84,748 `newfstatat` calls (0.48 s).

narayanls avatar Oct 16 '26 12:10 narayanls

Thank you for the clear report and the strace data! Your analysis is correct.

The problem has two parts:

  • Wayscriber sent /usr/share/icons as its tray IconThemePath. That folder holds every installed icon theme. Tray hosts already search it, so Wayscriber gained nothing when it sent it.
  • Noctalia scans the full IconThemePath folder each time it creates a tray widget. The drawer creates a new widget each time it opens, so the scan repeats. Noctalia tracks this in noctalia-dev/noctalia#4338, and a fix is in progress in noctalia-dev/noctalia#4341.

#413 removes the Wayscriber part, and it is now in main. An install under /usr no longer sends an IconThemePath. An install in a custom location, such as /opt, still sends its own icon folder.

We reproduced the delay with Noctalia 5.3.0 in a test session on Sway. With the old build, every drawer open was slow. With main, the delay was gone and the icon still showed. The empty WAYSCRIBER_ICON_THEME_PATH setting below gave the same result. Our test did not use niri or a cold boot, so a test on your system is still useful.

If you can, please test from main branch. It should be fixed on main.

If you do so:

  1. Build Wayscriber from main. The From source section lists the dependencies.
    git clone https://github.com/devmobasa/wayscriber.git
    cd wayscriber
    cargo build --release
    
  2. Stop the installed daemon. If you use systemd, run systemctl --user stop wayscriber.service.
  3. Start the new build with ./target/release/wayscriber --daemon.
  4. Remove wayscriber from the pinned list in Noctalia, so that the icon is in the drawer again.
  5. Open the drawer several times.
  6. When you finish the test, stop the new build. Then start the installed daemon again with systemctl --user start wayscriber.service.

Then please answer:

  • Does the drawer open without the delay?
  • Does the Wayscriber icon still show correctly?

If you cannot build main, you can get the same result with the current release:

  • If you start Wayscriber with systemd, run systemctl --user edit wayscriber.service. Add these lines, then run systemctl --user restart wayscriber.service:
    [Service]
    Environment=WAYSCRIBER_ICON_THEME_PATH=
    
  • If you start Wayscriber from your compositor configuration, start it with WAYSCRIBER_ICON_THEME_PATH= wayscriber --daemon.

With this setting, you can also reboot and report if the first open after boot is fast. That first open had the 20-second delay.

devmobasa avatar Oct 16 '26 16:10 devmobasa

Hello again, finished testing and it works! No more freezes.

narayanls avatar Oct 16 '26 16:10 narayanls

That's great! Thanks for reporting!

The fix is in main, and it will be in the next release. Until then, you can keep the WAYSCRIBER_ICON_THEME_PATH= setting or the pinned icon.

I am closing this issue now. If the freeze comes back, or if the Wayscriber icon does not show, please reopen it.

devmobasa avatar Oct 16 '26 16:10 devmobasa