blueman icon indicating copy to clipboard operation
blueman copied to clipboard

Full color icons missing in default icon theme

Open nebulosa2007 opened this issue 10 months ago • 33 comments

blueman: 2.4 BlueZ: 5.73-4 Distribution: Arch Linux Desktop environment: Niri (wayland)

After upgrading to version 2.4, my Bluetooth speaker is not listed, but I can interact with it. When left-clicking, a drop-down menu appears (e.g. "Rename" is selected ):

image

Log from the terminal (it adds more lines on hovering over the selected line). The Trust item also doesn't work (last 15 lines)

nebulosa2007 avatar Apr 01 '24 16:04 nebulosa2007

The crucial issue is Icon 'audio-card' not present in theme Adwaita. As audio-card definitely is part of the Adwaita Icon Theme, you seem to have an issue with your installed and active theme. In https://github.com/blueman-project/blueman/issues/2101#issuecomment-1663787627 just switching themes forth and back did the trick to fix it. :shrug:

cschramm avatar Apr 01 '24 19:04 cschramm

The fallback I added for this is broken. Blueman now skips making an IconInfo object which would return None instead of raising GEerror.

infirit avatar Apr 02 '24 09:04 infirit

In #2101 (comment) just switching themes forth and back did the trick to fix it. 🤷

I don't know how it can do this, I haven't gnome environment or Gnome setting apps..

Btw, after installing gnome-icon-theme package all the errors disappeared. I think this is an obsolete package in Arch, so I need other thoughts, If any.

adwaita-icon-theme package is already installed as a dependency of gtk3 and gtk4

image

nebulosa2007 avatar Apr 02 '24 11:04 nebulosa2007

In #2101 (comment) just switching themes forth and back did the trick to fix it. 🤷

I don't know how it can do this, I haven't gnome environment or Gnome setting apps..

If there's no specific support for it, editing $HOME/.config/gtk-3.0/settings.ini should do the trick, possibly combined with some kind of reload, but read on...

Btw, after installing gnome-icon-theme package all the errors disappeared. I think this is an obsolete package in Arch, so I need other thoughts, If any.

They came back when uninstalling, I suppose?

adwaita-icon-theme package is already installed as a dependency of gtk3 and gtk4

Exactly. It's a vital part of GTK as it ships defaults that all themes fall back to. That's why there is no good reason for audio-card to be unavailable.

My first guess would be some kind of broken cache. I'd try gtk-update-icon-cache (and probably switching icon themes forth and back has exactly that effect).

Another option could be a broken icon theme, that actually breaks the fallbacks. Not sure if that's possible.

cschramm avatar Apr 02 '24 11:04 cschramm

If there's no specific support for it, editing $HOME/.config/gtk-3.0/settings.ini should do the trick, possibly combined with some kind of reload, but read on...

I don't have files ..../gtk-3.0/settings.ini or ..../gtk-4.0/settings.ini

They came back when uninstalling, I suppose?

Yes, exactly.

My first guess would be some kind of broken cache. I'd try gtk-update-icon-cache (and probably switching icon themes forth and back has exactly that effect). Another option could be a broken icon theme, that actually breaks the fallbacks. Not sure if that's possible.

$ ls -1d /usr/share/icons/* | tee /dev/tty | xargs -I {} sudo gtk-update-icon-cache -f {}
/usr/share/icons/Adwaita/
/usr/share/icons/default/
/usr/share/icons/hicolor/
gtk-update-icon-cache: Cache file created successfully.
gtk-update-icon-cache: Cache file created successfully.

Didn't help again.

So it's just a distribution issue on Arch?

nebulosa2007 avatar Apr 02 '24 13:04 nebulosa2007

A simple test for a python shell:

import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
Gtk.IconTheme.get_default().load_surface("audio-card", 48, 1, None, Gtk.IconLookupFlags.FORCE_SIZE)

This is basically what blueman does, except that it gets the scale factor from GTK, so that it could be something else than 1 (typically 2) and it passes a window.

I expect this to always work as Adwaita ships a scalable audio-card icon with specified sizes between 8 and 512.

Just to double check: /usr/share/icons/default/ simply has an index.theme with the following, correct?

[Icon Theme]
Inherits=Adwaita

cschramm avatar Apr 02 '24 14:04 cschramm

Yes:

$ cat /usr/share/icons/default/index.theme 
[Icon Theme]
Inherits=Adwaita

And test output is:

$ python test.py 
Traceback (most recent call last):
  File "/home/nebulosa/test.py", line 4, in <module>
    Gtk.IconTheme.get_default().load_surface("audio-card", 48, 1, None, Gtk.IconLookupFlags.FORCE_SIZE)
gi.repository.GLib.GError: gtk-icon-theme-error-quark: Icon 'audio-card' not present in theme Adwaita (0)

nebulosa2007 avatar Apr 02 '24 14:04 nebulosa2007

Might be best to file a bug with the adwaita-icon-theme Arch package to get behind that. From my understanding, there is no way for it to not provide the icon. The path is basically: Directories in /usr/share/icons/Adwaita/index.theme containing symbolic/devices and a respective section:

[symbolic/devices]
Context=Devices
Size=16
MinSize=8
MaxSize=512
Type=Scalable

=> /usr/share/icons/Adwaita/symbolic/devices/audio-card-symbolic.svg gets used for sizes of 8 to 512.

cschramm avatar Apr 02 '24 14:04 cschramm

$ grep -A5 "\[symbolic/devices\]" /usr/share/icons/Adwaita/index.theme
[symbolic/devices]
Context=Devices
Size=16
MinSize=8
MaxSize=512
Type=Scalable

$ file /usr/share/icons/Adwaita/symbolic/devices/audio-card-symbolic.svg
/usr/share/icons/Adwaita/symbolic/devices/audio-card-symbolic.svg: SVG Scalable Vector Graphics image

I'll make an issue on a Archlinux bugtracker then.

edit: issue on Archlinux bug tracker

nebulosa2007 avatar Apr 02 '24 14:04 nebulosa2007

The fallback I added for this is broken. Blueman now skips making an IconInfo object which would return None instead of raising GEerror.

#2316 fixes the fallback for broken icon themes.

infirit avatar Apr 02 '24 18:04 infirit

New info! After link file (or copy) and update icons cache all errors are gone:

$ sudo ln -s /usr/share/icons/Adwaita/symbolic/devices/audio-card-symbolic.svg /usr/share/icons/Adwaita/symbolic/devices/audio-card.svg 

$ ls -1d /usr/share/icons/* | tee /dev/tty | xargs -I {} sudo gtk-update-icon-cache -f {}
/usr/share/icons/Adwaita/
/usr/share/icons/default/
/usr/share/icons/hicolor/
gtk-update-icon-cache: Cache file created successfully.
gtk-update-icon-cache: Cache file created successfully.

image Btw, this icon is different than above.

I think that blueman looking for exactly audio-card.* but not audio-card<whatever>.* file and take the biggest one as possible. I found icon from previous screenshot here /usr/share/icons/gnome/48x48/devices/audio-card.png

image This icons also can be fixed by changing filenames I suppose..

nebulosa2007 avatar Apr 03 '24 08:04 nebulosa2007

I'm totally confused, but, yes, the symbolic version is the only one in the package and it does not seem to get used unless requested explicitly (by name or with Gtk.IconLookupFlags.FORCE_SYMBOLIC). It looks like adwaita-icon-theme 44 dropped non-symbolic icons, not even reflecting that in the changelog.

cschramm avatar Apr 03 '24 09:04 cschramm

There are a bunch of issues on the adwaita icon theme gitlab about full corour icons that got dropped the 44 release. The issues I checked were fixed by re-adding them.

infirit avatar Apr 03 '24 11:04 infirit

Only very few of the icons I listed in https://github.com/blueman-project/blueman/issues/976#issuecomment-450735133 are still available as non-symbolic, namely computer, image-missing, input-*, network-workgroup, phone and printer. Wtf... :confused:

cschramm avatar Apr 03 '24 12:04 cschramm

I took your list and checked which one I had on my system.

Missing

  • audio-card
  • camera-photo
  • camera-video
  • modem
  • network-wireless

In scalable directory

  • computer
  • input-gaming
  • input-keyboard
  • input-mouse
  • input-tablet
  • phone
  • printer

I don't use Adwaita as icon theme so I never noticed them missing.

infirit avatar Apr 03 '24 20:04 infirit

That's just one part of the list, namely names provided by BlueZ. Of all the other icons that we use image-missing and network-workgroup are the only ones still available.

cschramm avatar Apr 05 '24 08:04 cschramm

Still unsure where to go from here. One obvious solution would be to always use symbolic icons for everything...

cschramm avatar Apr 05 '24 08:04 cschramm

Oh, forget what I wrote. We're already using symbolic icons in many places anyway. Is this actually just an issue with BlueZ-provided device icons? :thinking: Would be easy to force symbolic ones there of course.

Edit: It's not. We e.g. use dialog-error.

Quick experiment in #2330

cschramm avatar Apr 05 '24 09:04 cschramm

Let's try!

# Check files:
$ file /usr/share/icons/Adwaita/symbolic/devices/audio-card-symbolic.svg
/usr/share/icons/Adwaita/symbolic/devices/audio-card-symbolic.svg: SVG Scalable Vector Graphics image
$ file  /usr/share/icons/Adwaita/symbolic/devices/audio-card.svg
/usr/share/icons/Adwaita/symbolic/devices/audio-card.svg:          cannot open `/usr/share/icons/Adwaita/symbolic/devices/audio-card.svg' (No such file or directory)

Built and installed packages with patches, here are the results: 2.4 + #2316: Screenshot from 2024-04-05 17-32-09

2.4 + #2330: Screenshot from 2024-04-05 17-50-29

2.4 + #2316 + #2330: Screenshot from 2024-04-05 17-53-59

But those icons are still broken: image

Edit: After reboot (?) icons got back. So for me, it seems, that issue can be closed. All icons got back

nebulosa2007 avatar Apr 05 '24 15:04 nebulosa2007

But those icons are still broken: image

I don't get what you mean there.

Edit: After reboot (?) icons got back. So for me, it seems, that issue can be closed. All icons got back

You're not saying you have device icons without any patches now, are you? :sweat_smile:

cschramm avatar Apr 05 '24 21:04 cschramm

I don't get what you mean there.

Never mind. Icons (orange and blue) appears when device is connected. Didn't notice it before.

You're not saying you have device icons without any patches now, are you? 😅

Nope. Device icons appear when I apply the #2330 patch (with or without patch #2316) and build the package afterwards. For now I will wait for upstream updates and use the patched version.

P.S. Not only blueman has this issue, I checked also pavucontrol and found the rabbit hole

nebulosa2007 avatar Apr 06 '24 06:04 nebulosa2007

Typical gnome behaviour. Looks like we need resurrect our old icons or find a new set.

infirit avatar Apr 06 '24 09:04 infirit

I fail to find a proper primary source, but at least https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/issues/242 makes it very clear that

a-i-t is no longer some icon and cursor pack for everyone to use and apps should bundle their own icons

Unfortunately that effectively means that there just is no "icon pack for everyone to use", it seems. Wow, what a mess... :unamused:

Well, we can just choose an icon theme that we like and that fits our license (fingers crossed :crossed_fingers: :sweat_smile:) and bundle their icons. Most desktops will override them anyway and maintainers could strip them from their blueman packages (I do not really see how they set their packages up then, though, as they'd have to scan all their distribution's icon themes for compatibility to indicate that any of the compatible ones is a dependency of blueman).

To put it more precisely: Wow, what a ridiculous mess for the whole Linux desktop!

cschramm avatar Apr 08 '24 17:04 cschramm

We can add additional search paths to the Gtk.IconTheme and point it to fallback icons we provide in some directory we control. Something like /usr/share/blueman/icons. I kinda hope distributions will drop Adwaita as the default and use something that provides full color icons following the icon naming spec.

edit: I updates the description.

infirit avatar Apr 08 '24 20:04 infirit

In the meantime, make sure that your packages depend on proper icons themes.

Arch Linux has no default icon themes, only those provided by program developers. That's how I discovered this bug. If it will be just symbolic icons that's will be fine I guess.

nebulosa2007 avatar Apr 09 '24 10:04 nebulosa2007

They have to and do. The content of the file you checked before (below) can't inherit from Adwaita anymore. So whatever this is set to has to provide a full icon theme that applications should be able to rely on.

$ cat /usr/share/icons/default/index.theme 
[Icon Theme]
Inherits=Adwaita

infirit avatar Apr 09 '24 12:04 infirit

By now budgie, cinnamon and plasma have blacklisted adwaita in their system settings ui as it is no longer an fdo compatible icon theme.

My suggestion is we also enforce at lesst one compatibe theme at build time. Breeze can be added to the list as it has everything we need.

infirit avatar May 04 '24 10:05 infirit

Breeze can be added to the list as it has everything we need.

Does it? Querying just a few icon names from our code, it does not seem to have e.g. application-x-addon-symbolic, modem-symbolic, or gnome-power-manager-symbolic and we cannot assume a fallback on Adwaita for them, can we?

Papirus looks pretty complete from a quick glance.

Even worse than finding compatible themes, MATE's and Linux Mint's seem incompatible as well, they e.g. lack application-x-addon-symbolic.

cschramm avatar May 10 '24 11:05 cschramm

Hi @cschramm and @infirit,

Are you on Matrix or IRC? I'd love to help and get your feedback on this. It's affecting a lot of people and projects right now, DEs, distros, apps :)

clefebvre avatar May 10 '24 15:05 clefebvre

I'm on neither @clefebvre. The best place to get the latest on this is this issue created by Nate Graham from KDE, https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/issues/288.

Specifically this comment from the AIT maintainer is a reasonable solution.

However AIT as of commit https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/commit/788c7a2c0ff0b95d540148715c7cee612e9404f8 has a fallback to Tango. That would probably be the best short term solution.

edit: tango looks very dated though so maybe not :shrug:

infirit avatar May 10 '24 20:05 infirit