Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Sway Taskbar icons missing for some programs #259

Closed
buckket opened this issue Oct 24, 2023 · 13 comments · Fixed by #260
Closed

[BUG] Sway Taskbar icons missing for some programs #259

buckket opened this issue Oct 24, 2023 · 13 comments · Fixed by #260

Comments

@buckket
Copy link

buckket commented Oct 24, 2023

Describe the bug
The Sway Taskbar module does not show the appropriate icon for some programs, just a generic placeholder.

To Reproduce

  1. Enable Sway Taskbar module with "Show icon" turned on
  2. Start Thunderbird or Signal-Desktop

Expected behavior
The program icon should be displayed in the taskbar instead of a placeholder, just like for any other program.

Desktop:

  • Arch Linux
  • sway version 1.8.1
  • nwg-panel version 0.9.14

Additional context
Here is the output of swaymsg -t get_tree for the two examples where the icon is not shown:

  • con "Mozilla Thunderbird" (xdg_shell, pid: 2870, app_id: "thunderbird")
  • con "Signal" (xwayland, pid: 61001, instance: "signal", class: "Signal", X11 window: 0x1600003)

The .desktop files for those programs on Arch are:

  • org.mozilla.Thunderbird.desktop with Icon=org.mozilla.Thunderbird
  • signal-desktop.desktop with Icon=signal-desktop

I don't know how nwg-panel actually implements the icon assignment, but both .desktop files also include a StartupWMClass field which matches the app_id or class of the program windows respectively, which could be used for this purpose.

@nwg-piotr
Copy link
Owner

nwg-piotr commented Oct 24, 2023

I don't use thunderbird, but installed for testing, and your issue doesn't appear on my side:

image

Same if it comes to Telegram:

image

Did you consider an issue with your icon theme? Check with nwg-icon-picker if it contains such icon names, please.

@buckket
Copy link
Author

buckket commented Oct 24, 2023

Okay, strange.

When I search for firefox it shows:
/usr/share/icons/hicolor/scalable/apps/firefox.svg

For telegram (which also works for me):
/usr/share/icons/hicolor/256x256/apps/telegram.png

But when I search for thunderbird no icon shows up, I have to explicitly search for org.mozilla.Thunderbird and then I get the correct icon, namely: /usr/share/icons/hicolor/256x256/apps/org.mozilla.Thunderbird.png

So it definitely exists and is installed but it doesn't seem to get associated with the Thunderbird process or window correctly.

@nwg-piotr
Copy link
Owner

I'm pretty sure it's an issue on you side. Try installing and setting some good icon theme, e.g. Papirus or Tela.

@buckket
Copy link
Author

buckket commented Oct 24, 2023

I’m not sure why I would need an additional icon theme.

The program icons are included with the program when you install the package via the package manager.

As I mentioned the Thunderbird icons are definitely installed and are at the right location. nwg-icon-picker even shows them when I enter the exact file name.

I just tried installing xfce4-appfinder and there the icons are all shown correctly, which leads me to believe that it has to be a problem with nwg-panel.

Screenshot from 2023-10-24 at 11_51_06 184226223

Screenshot from 2023-10-24 at 11_52_29 836586258

@nwg-piotr
Copy link
Owner

I’m not sure why I would need an additional icon theme.

To find out if the icon theme the is the culprit. Of course you don't have to, but the panel has hundreds of users that have no such issue.

@buckket
Copy link
Author

buckket commented Oct 24, 2023

I just installed papirus-icon-theme, and now Thunderbird shows an Icon, but I’m pretty sure that's because papirus-icon-theme installs thunderbird.svg AND org.mozilla.Thunderbird.svg.

The correct naming scheme and icon as specified in the .desktop file is org.mozilla.Thunderbird though, so I’d expect nwg-panel to look for and use that.

Signal still doesn’t work.

@buckket
Copy link
Author

buckket commented Oct 24, 2023

The problem seems to be the same as #64, but the proposed fix apparently doesn't work for me.

Looking at the code I suspect because org.mozilla.Thunderbird has a capital T and the app_id is with a lower t. So it never matches and doesn't load the icon.

For Signal it doesn't work as there is no way to match signal-desktop to signal with the current code.

So as I mentioned in the beginning we should also parse the StartupWMClass field of the .desktop files and match those to the windows we're seeing and then choose the icon based on that.

@nwg-piotr
Copy link
Owner

It seems I know what goes wrong. Will try to fix it.

nwg-piotr added a commit that referenced this issue Oct 24, 2023
@nwg-piotr
Copy link
Owner

nwg-piotr commented Oct 24, 2023

OK. I can search all org.name.whatever.else-named .desktop files every time the desktop file is not named as it should be (<app_id.desktop>), but it will cost quite a lot of additional disk operations. I added a fix, but I still strongly recommend using icon themes that provide well named icons. If we have just the thunderbird icon, we have no need to search .desktop files.

@erlehmann
Copy link

I think the fix in 9bd89f1 could select the wrong icon for desktop files that use a language-specific icon, for example:

Icon[de] = foo
Icon[en] = bar
Icon = baz

@nwg-piotr
Copy link
Owner

nwg-piotr commented Oct 24, 2023

Why? The line will be split on "=" anyway. Actually I don't care much. We will never address all possible misbehavior. And parsing .desktop files is just a fallback.

@erlehmann
Copy link

Why? The line will be split on "=" anyway. Actually I don't care much. We will never address all possible misbehavior. And parsing .desktop files is just a fallback.

Your code will not use the language-specific icon. It will, instead, use the first icon that was found.

@nwg-piotr
Copy link
Owner

Your code will not use the language-specific icon. It will, instead, use the first icon that was found.

It's a minor issue. I haven't yet seen a .desktop file with lang-specific icons in real life.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants