~tsdh/swayr#32: 
Icon for telegram desktop

The app_id is org.telegram.desktop the desktop file org.telegram.desktop.desktop and the icon telegram.png.

swayr was unable to locate it correctly.

Status
REPORTED
Submitter
~modprog
Assigned to
No-one
Submitted
2 years ago
Updated
2 years ago
Labels
bug swayr waiting_for_feedback

~tsdh 2 years ago

Could you please tell me where the desktop file resides? Does it reside in some other location as desktop files where it works?

And please copy&paste its content here.

~tsdh 2 years ago*

FWIW, I've installed community/telegram-desktop 4.5.3-1 here on Arch and the icon was resolved to /usr/share/icons/hicolor/128x128/apps/telegram.png. Do you have the folder with the image in format.icon_dirs? The default is

icon_dirs = [
    '/usr/share/icons/hicolor/scalable/apps',
    '/usr/share/icons/hicolor/128x128/apps',
    '/usr/share/icons/hicolor/64x64/apps',
    '/usr/share/icons/hicolor/48x48/apps',
    '/usr/share/icons/Adwaita/64x64/apps',
    '/usr/share/icons/Adwaita/48x48/apps',
    '/usr/share/pixmaps',
]

Does the telegram.png reside in any of those folders? If not, you have to add it.

~modprog 2 years ago

That is confusing, I installed swayr-git from the aur and telegram from community. I do have the default icon_dirs as well. I'll maybe put a dbg! in the code finding the icons to see what's going on.

~modprog 2 years ago

Nevermind, a reboot restored the icon. apparently it works with community but not with telegram-desktop-bin from the aur.

~modprog 2 years ago

One thing I noticed is, that some applications like dolphin or pavucontrol use e.g. system-file-manager. In the default Adwaita is used as an icon theme AFAICT, the matching adwaita icons would be:

./Adwaita/48x48/legacy/system-file-manager-symbolic.symbolic.png
./Adwaita/scalable/legacy/system-file-manager-symbolic.svg
./Adwaita/24x24/legacy/system-file-manager-symbolic.symbolic.png
./Adwaita/32x32/legacy/system-file-manager-symbolic.symbolic.png
./Adwaita/64x64/legacy/system-file-manager-symbolic.symbolic.png
./Adwaita/16x16/legacy/system-file-manager-symbolic.symbolic.png
./Adwaita/96x96/legacy/system-file-manager-symbolic.symbolic.png

But I think it cannot match those due to the .symbolic even when I add them to the icon_dirs.

~tsdh 2 years ago

I think it should work with telegram-desktop-bin, too, at least if the desktop file names an icon in the default directories. It might be that this package puts its icon somewhere else, e.g., somewhere below /usr/local/share/icons/. In that case, put the directory in icon_dirs.

What do you mean with some applications "use e.g. system-file-manager"?

~modprog 2 years ago*

The .desktop file from dolphin specifies Icon=system-file-manager. And that seams to break swayr's logic.

My guess is, it is because the icon files are called -symbolic.symbolic.png.

~modprog 2 years ago*

Concerning telegram-desktop-bin it has the app_id: org.telegram.desktop, places its icon at: /usr/share/icons/hicolor/128x128/apps/telegram.png and its .desktop file at: /usr/share/applications/telegramdesktop.desktop:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=Telegram Desktop
Comment=Official desktop version of Telegram messaging app
Exec=telegram-desktop -- %u
StartupWMClass=telegram-desktop
Icon=telegram
Terminal=false
Type=Application
Categories=Network;
MimeType=application/x-xdg-protocol-tg;x-scheme-handler/tg;
X-Desktop-File-Install-Version=0.22

~tsdh 2 years ago*

You can check how swayr computs the mapping from app_ids to icons in https://git.sr.ht/~tsdh/swayr/tree/main/item/swayr/src/util.rs#L136.

So basically it parses all <foo>.desktop files on your system and reads the Icon: <icon> value and adds the following mappings to the icon path if <icon> exists in any directory in icon_dirs as PNG or SVG file:

  • <foo>, i.e., the desktop file name without extension
  • the value of StartupWMClass in the desktop file
  • foo, if <foo> is like org.gnome.foo, i.e., the last part if the desktop file has a domain-name like notation

As you can see, for the telegramdesktop.desktop it would derive the possible app_ids telegramdesktop (desktop file name) and telegram-desktop (StartupWMClass). That it identifies as org.telegram.desktop cannot be derived from the desktop file.

I could possibily do the domain-name-hack not only when computing the map possible-app-ids-to-icon but also when looking up in that map, but then I would assume the last part of the app_id is the thing defining the app, e.g., with an app_id org.gnome.eog the app is eog. However, with your case of an app_id org.telegram.desktop the app is actually the middle part telegram and not the last part desktop. Or actually, it's the combination of middle and last part. I mean, this could also be tried, but where is the stopping point for such strange heuristics?

I'll have a look and check how feasible that would be.

~tsdh 2 years ago

And with respect to Icon=system-file-manager where the actual icon in named system-file-manager-symbolic.symbolic.png: I have no clue what that means. I didn't find anything about this in the icon theme specification at https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html...

FWIW, I don't have KDE or Dolphin installed but I still do have icons which would match:

 locate system-file-manager
/usr/share/icons/Adwaita/16x16/legacy/system-file-manager-symbolic.symbolic.png
/usr/share/icons/Adwaita/24x24/legacy/system-file-manager-symbolic.symbolic.png
/usr/share/icons/Adwaita/32x32/legacy/system-file-manager-symbolic.symbolic.png
/usr/share/icons/Adwaita/48x48/legacy/system-file-manager-symbolic.symbolic.png
/usr/share/icons/Adwaita/64x64/legacy/system-file-manager-symbolic.symbolic.png
/usr/share/icons/Adwaita/96x96/legacy/system-file-manager-symbolic.symbolic.png
/usr/share/icons/Adwaita/scalable/legacy/system-file-manager-symbolic.svg
/usr/share/icons/HighContrast/16x16/apps/system-file-manager.png
/usr/share/icons/HighContrast/22x22/apps/system-file-manager.png
/usr/share/icons/HighContrast/24x24/apps/system-file-manager.png
/usr/share/icons/HighContrast/256x256/apps/system-file-manager.png
/usr/share/icons/HighContrast/32x32/apps/system-file-manager.png
/usr/share/icons/HighContrast/48x48/apps/system-file-manager.png
/usr/share/icons/HighContrast/scalable/apps/system-file-manager.svg

They are provided by gnome-themes-extra. Well, not overly helpful for a KDE-user. :-) You could just add ~/.local/share/icons/ to icon_dirs and create a symlink system-file-manager.png -> .../system-file-manager-symbolic.symbolic.png.

~tsdh 2 years ago

I've made a change on master so that icons like my-app-symbolic.png and my-app-symbolic.symbolic.png will also be found if the desktop file says the icon is my-app. Of course, you would still need to add the ../legacy/ directories to icon_dirs.

Register here or Log in to comment, or comment via email.