[GH-ISSUE #1279] tray module does not update icons #386

Closed
opened 2026-05-22 21:53:05 +01:00 by JakeStanger · 5 comments
Owner

Originally created by @ejrichards on GitHub (Dec 17, 2025).
Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/1279

Describe the bug
Tray icons do not update, eg when an application updates its icon to display that a notification is available.

To reproduce
Steps to reproduce the behavior:

  1. Add module tray
  2. Open a program that updates its tray icon, for example, Discord
  3. When there are unread messages, the tray icon does not update

Expected behavior
A red dot should appear. This also occurs with Zulip, which updates the icon to be the number of unread messages.

System information:

  • Distro: NixOS
  • Ironbar version: nixpkgs 0.17.1 and main

Configuration

Config
[[end]]
type = "tray"
Styles Occurs with no CSS styling

Log error every time an update should happen

WARN system_tray::client: 459: Error getting IconName: ZBusFdo(Failed("error occurred in Get"))

This is also in the logs, although I'm not sure if it is relevant

WARN system_tray::client: 469: org.freedesktop.DBus.Error.InvalidArgs: No such property “IconPixmap”
Originally created by @ejrichards on GitHub (Dec 17, 2025). Original GitHub issue: https://github.com/JakeStanger/ironbar/issues/1279 **Describe the bug** Tray icons do not update, eg when an application updates its icon to display that a notification is available. **To reproduce** Steps to reproduce the behavior: 1. Add module `tray` 2. Open a program that updates its tray icon, for example, Discord 3. When there are unread messages, the tray icon does not update **Expected behavior** A red dot should appear. This also occurs with Zulip, which updates the icon to be the number of unread messages. **System information:** - Distro: NixOS - Ironbar version: nixpkgs 0.17.1 and main **Configuration** <details><summary>Config</summary> ```toml [[end]] type = "tray" ``` </details> <details><summary>Styles</summary> Occurs with no CSS styling </details> Log error every time an update should happen ``` WARN system_tray::client: 459: Error getting IconName: ZBusFdo(Failed("error occurred in Get")) ``` This is also in the logs, although I'm not sure if it is relevant ``` WARN system_tray::client: 469: org.freedesktop.DBus.Error.InvalidArgs: No such property “IconPixmap” ```
JakeStanger 2026-05-22 21:53:05 +01:00
Author
Owner

@JakeStanger commented on GitHub (Dec 17, 2025):

I've observed this myself, and it seems to be a problem with Electron having some bogus implementation of the SNI protocol. I think (need to confirm) Plasma handles it correctly, so presumably there is a workaround.

<!-- gh-comment-id:3664503526 --> @JakeStanger commented on GitHub (Dec 17, 2025): I've observed this myself, and it seems to be a problem with Electron having some bogus implementation of the SNI protocol. I _think_ (need to confirm) Plasma handles it correctly, so presumably there is a workaround.
Author
Owner

@Windblows2000 commented on GitHub (Dec 18, 2025):

I tried taking look at it for a cheap fix. It seems that the implementation is indeed inconsistent between the different applications. I tried LM Studio, Vesktop (dont have the official Discord client so I cant confirm it), and Cachy-Update. Each did throw a different failure that made it impossible to update the icon. LM Studio sent an icon_name None, while Vesktop couldn't even send one over zbus.

A redraw if either the name or pixmap data change seems to do the trick. Though I'm unsure how that affects performance (Cachy-Update shot 4 icon updates at once.)

// src/modules/tray/mod.rs

UpdateEvent::Icon {
    icon_name,
    icon_pixmap,
} => {
    let name_changed = icon_name.as_ref() != menu_item.icon_name();
    let pixmap_changed = icon_pixmap != menu_item.icon_pixmap;

    if name_changed || pixmap_changed {
        menu_item.icon_pixmap = icon_pixmap;
        menu_item.set_icon_name(icon_name);

        match icon::get_image(
            menu_item,
            icon_config.size,
            icon_config.prefer_theme,
            &icon_config.theme,
        ) {
            Ok(image) => menu_item.set_image(&image),
            Err(e) => {
                error!("error loading icon: {e}");
                menu_item.show_label();
            }
        }
    }
}
<!-- gh-comment-id:3669815719 --> @Windblows2000 commented on GitHub (Dec 18, 2025): I tried taking look at it for a cheap fix. It seems that the implementation is indeed inconsistent between the different applications. I tried LM Studio, Vesktop (dont have the official Discord client so I cant confirm it), and Cachy-Update. Each did throw a different failure that made it impossible to update the icon. LM Studio sent an icon_name None, while Vesktop couldn't even send one over zbus. A redraw if either the name or pixmap data change seems to do the trick. Though I'm unsure how that affects performance (Cachy-Update shot 4 icon updates at once.) ```rs // src/modules/tray/mod.rs UpdateEvent::Icon { icon_name, icon_pixmap, } => { let name_changed = icon_name.as_ref() != menu_item.icon_name(); let pixmap_changed = icon_pixmap != menu_item.icon_pixmap; if name_changed || pixmap_changed { menu_item.icon_pixmap = icon_pixmap; menu_item.set_icon_name(icon_name); match icon::get_image( menu_item, icon_config.size, icon_config.prefer_theme, &icon_config.theme, ) { Ok(image) => menu_item.set_image(&image), Err(e) => { error!("error loading icon: {e}"); menu_item.show_label(); } } } } ```
Author
Owner

@JakeStanger commented on GitHub (Dec 18, 2025):

The best test-case for performance would be nm-applet. Disabling and enabling the adaptor will cause it to re-connect, which should show an animation. Each animation frame is sent as an icon update. That should work, at least...

So long as the menu itself isn't re-rendered, it should be cheap enough.

<!-- gh-comment-id:3669859560 --> @JakeStanger commented on GitHub (Dec 18, 2025): The best test-case for performance would be `nm-applet`. Disabling and enabling the adaptor will cause it to re-connect, which should show an animation. Each animation frame is sent as an icon update. That should work, at least... So long as the menu itself isn't re-rendered, it should be cheap enough.
Author
Owner

@Windblows2000 commented on GitHub (Dec 18, 2025):

Thank you for the response.

Just tested nm-applet by reconnecting to the network. The logic seems solid. It correctly captures the animation frames while avoiding duplicates. the check name_changed || pixmap_changed makes sure of that.

<!-- gh-comment-id:3669997218 --> @Windblows2000 commented on GitHub (Dec 18, 2025): Thank you for the response. Just tested ```nm-applet``` by reconnecting to the network. The logic seems solid. It correctly captures the animation frames while avoiding duplicates. the check ```name_changed || pixmap_changed``` makes sure of that.
Author
Owner

@JakeStanger commented on GitHub (Dec 18, 2025):

Cool in that case if you want to submit a PR I can get that turned around pretty quick for you

<!-- gh-comment-id:3670571031 --> @JakeStanger commented on GitHub (Dec 18, 2025): Cool in that case if you want to submit a PR I can get that turned around pretty quick for you
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
JakeStanger/ironbar#386
No description provided.