Bug 498533 - Custom icons in XWayland-using apps' custom desktop files are ignored
Summary: Custom icons in XWayland-using apps' custom desktop files are ignored
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: 6.2.5
Platform: Debian unstable Linux
: NOR minor
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-11 15:41 UTC by Petro
Modified: 2025-01-15 23:21 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.3.0
Sentry Crash Report:


Attachments
Initial process, just after execution (9.46 KB, image/png)
2025-01-14 20:48 UTC, Petro
Details
program icon after 5 seconds (8.30 KB, image/png)
2025-01-14 20:49 UTC, Petro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Petro 2025-01-11 15:41:56 UTC
SUMMARY
Icons not properlly bounded to runnig program instance i.e.
when one is using freeGLUT software such as mupdf even if icon is configured after executing program plasma panel shows other icon then configured.
Behaviour is seen also with other programs when icon is set individually i.e. when one is run chromium with custom icon and layout.
It is seen also then one have emacs client server relation, when emacs client windos is started form panel icon plasma creates new icon

STEPS TO REPRODUCE
MuPDF
1. Install
2. set custom icon
3. check if icon is persented under right button menu
3. start any pdf document
3. Observe icon on the dash panel 
Worth to notice that FreeGLUT has no portable way of specifying an application icon, so mupdf-gl on
x11 or wayland does not even try to set an application icon.

I believe your issue is with either KDE or a KDE/FreeGLUT interaction, where window manager is failing to set the icon you want for mupdf-gl's window.
-----
Chromium
1. Install
2. configure custom layout by flags:
'--app=https://bugs.kde.org --user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:115.0) Gecko/20100101 Firefox/115.0' %U
3. Chage icon for custom one
4. Check the behaviour on the dash
OBSERVED RESULT
- muPDF doesn't even tries to set correct icon, there is only one X seen
- Chromium, even at start shows custom icon, after system upgrade icon is changed to default icon for chrome/ium.
- Emacs, even on the plasma panel there is emacs client icon plasma creates new one for and all instanses cumulates under this new icon instance. 
EXPECTED RESULT
- muPDF icon shall be also present on plasma panel
- Chromium custom icon shall be always shown if started from custom icon occur
- Emacs custom client icon shall be energied when window is created and present on plasma desktop.
SOFTWARE/OS VERSIONS
Operating System: Debian sid
DE Plasma Version: 6.2.5
KDE Frameworks Version: 6.8.0
Qt Version: 6.7.2
Kernel Version: 6.8.12-amd64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 PRO 4750U with Radeon Graphics
Memory: 15.0 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Comment 1 TraceyC 2025-01-13 22:40:54 UTC
Hi Petro,

If I correctly understand what's happening on your system, you have set custom icons for MuPDF, Chromium and emacs. They are not behaving in Plasma as expected.

Please let me know, step by step, how you set the custom icon for MuPDF so I can reproduce this on my system. There are different ways to set a custom icon, so I need to know exactly what you did. Thanks!
Comment 2 TraceyC 2025-01-13 22:49:39 UTC
.
Comment 3 Petro 2025-01-14 09:57:30 UTC
 After installation package MuPDF in debian has no set defalult icon(or entry in the laucher) so: 
 1. For MuPDF I have created desktop entry as follows:
 
[Desktop Entry]
Categories=Viewer;Graphics;
Comment[pl_PL]=
Comment=
Exec=/usr/bin/mupdf-gl -Y 0.8 -r 120 %f
GenericName[pl_PL]=PDF file viewer
GenericName=PDF file viewer
Icon=mupdf
MimeType=application/vnd.ms-xpsdocument;application/pdf;application/epub+zip;
Name[pl_PL]=MuPDF
Name=MuPDF
NoDisplay=true
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
TryExec=mupdf
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=

2 Next step is to just start the program mupdf from app laucher
3. During start one can observe at the begging there is present icon mupdf (during the 5 sec bouncer time) however after few secs it change itself to X.Org.Logo Ico

Chosen icon is correctlly visible from app laucher and right button menu.
Comment 4 Nate Graham 2025-01-14 17:30:50 UTC
Did you create that file manually and then put it in `~/.local/share/applications`/? Or was it created by your use of KMenuEdit or the properties dialog?

Note that "NoDisplay=true" is probably not what you want if your goal is to override the default presentation of the app; I'd recommend removing that line.
Comment 5 Petro 2025-01-14 20:48:01 UTC
Created attachment 177358 [details]
Initial process, just after execution
Comment 6 Petro 2025-01-14 20:49:23 UTC
Created attachment 177359 [details]
program icon after 5 seconds
Comment 7 Petro 2025-01-14 20:52:45 UTC
.desktop file been created over system tool and "NoDisplay=true" been added automatically, for test I have removed that line from the file and there is no change in behaviour.
Comment 8 Nate Graham 2025-01-14 20:57:05 UTC
I suspect this is one of those apps that changes its StartupWMClass after launch, or something similar.

Can you launch MuPDF, run `xprop` in a terminal window, and then click on the MuPDF window? Paste the text it outputs here.
Comment 9 Petro 2025-01-14 21:01:03 UTC
t0@lonas:~/.local/share/applications$ xprop
_VARIABLE_REFRESH(CARDINAL) = 1
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE
_KDE_NET_WM_FRAME_STRUT(CARDINAL) = 1, 1, 28, 1
_NET_FRAME_EXTENTS(CARDINAL) = 1, 1, 28, 1
_NET_WM_DESKTOP(CARDINAL) = 0
_KDE_NET_WM_ACTIVITIES(STRING) = "ef2f1bc0-3e40-4893-a42c-8741d13cd776"
WM_STATE(WM_STATE):
                window state: Normal
                icon window: 0x0
_NET_WM_STATE(ATOM) = _NET_WM_STATE_FOCUSED
_NET_WM_PID(CARDINAL) = 23077
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW
WM_LOCALE_NAME(STRING) = "C"
_KDE_NET_WM_USER_CREATION_TIME(CARDINAL) = 22261298
WM_HINTS(WM_HINTS):
                Initial state is Normal State.
WM_NORMAL_HINTS(WM_SIZE_HINTS):
                user specified size: 494 by 494
WM_CLIENT_MACHINE(STRING) = "lonas"
WM_ICON_NAME(STRING) = "MuPDF: Open document"
WM_NAME(STRING) = "MuPDF: Open document"
Comment 10 Nate Graham 2025-01-15 18:27:52 UTC
Thanks. I didn't see what I was looking for, so at this point it's beyond me. I suspect that this is either a bug in the app, or else the result of incorrect custom icon setup, but I can't prove either of them.
Comment 11 TraceyC 2025-01-15 18:46:19 UTC
(In reply to Petro from comment #3)
>  After installation package MuPDF in debian has no set defalult icon(or
> entry in the laucher) 

I wanted to comment on this specifically. If MuPDF does not appear in the application launcher, that is a packaging problem. I encourage you to report this to debian so they can correct this using the report bug utility (https://packages.debian.org/stable/utils/reportbug)

With that said, you should still be able to create menu entries and add custom icons to entries. We will address that part.
Comment 12 Petro 2025-01-15 19:42:58 UTC
This is my first thought about to post a bug for muPDF and I did it and maybe shall refresh it. I checked again with fresh user and noticed that, I been wrong about icon, this icon is present in the right button menu at first run, when I start mupdf-x11 version, icon is correctly presneted on the panel, problem is only with mupdf-gl. One day I'm going to test it with gnome.
Comment 13 Nate Graham 2025-01-15 21:39:22 UTC
Most of the issue for MuPDF should be fixed by https://invent.kde.org/plasma/kwin/-/merge_requests/7018, scheduled to land in Plasma 6.3.0. What remains is the app's fault, since it provides zero metadata we can use to map its window to an icon, so we have to fall back to the executable name.

Unfortunately it's quite common that individual apps have broken code or metadata in a variety of creative ways. Let's call this bug fixed for MuPDF, to the extent that we *can* fix anything.

After upgrading to Plasma 6.3 (which has the fix), please open individual new bug reports for each other app that you encounter a similar issue with.
Comment 14 Bug Janitor Service 2025-01-15 23:21:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5075
Comment 15 Nicolas Fella 2025-01-15 23:21:57 UTC
(In reply to Bug Janitor Service from comment #14)
> A possibly relevant merge request was started @
> https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5075

This makes the MuPDF icon appear correctly