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.
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.
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 informat.icon_dirs
? The default isicon_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.
That is confusing, I installed
swayr-git
from the aur andtelegram
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.
Nevermind, a reboot restored the icon. apparently it works with community but not with
telegram-desktop-bin
from the aur.
One thing I noticed is, that some applications like
dolphin
orpavucontrol
use e.g.system-file-manager
. In the defaultAdwaita
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.
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 inicon_dirs
.What do you mean with some applications "use e.g. system-file-manager"?
The
.desktop
file fromdolphin
specifiesIcon=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
.
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
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 theIcon: <icon>
value and adds the following mappings to the icon path if<icon>
exists in any directory inicon_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 likeorg.gnome.foo
, i.e., the last part if the desktop file has a domain-name like notationAs 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 iseog
. However, with your case of an app_idorg.telegram.desktop
the app is actually the middle parttelegram
and not the last partdesktop
. 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.
And with respect to
Icon=system-file-manager
where the actual icon in namedsystem-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.svgThey are provided by gnome-themes-extra. Well, not overly helpful for a KDE-user. :-) You could just add
~/.local/share/icons/
toicon_dirs
and create a symlinksystem-file-manager.png -> .../system-file-manager-symbolic.symbolic.png
.
I've made a change on master so that icons like
my-app-symbolic.png
andmy-app-symbolic.symbolic.png
will also be found if the desktop file says the icon ismy-app
. Of course, you would still need to add the../legacy/
directories toicon_dirs
.