Bug 460403 - Task switcher is ignoring the icon set in the .desktop launcher and associated with the application through StartupWMClass
Summary: Task switcher is ignoring the icon set in the .desktop launcher and associat...
Status: RESOLVED DUPLICATE of bug 459735
Alias: None
Product: kwin
Classification: Plasma
Component: tabbox (show other bugs)
Version: 5.27.3
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-14 02:10 UTC by Shmerl
Modified: 2025-01-14 19:07 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shmerl 2022-10-14 02:10:31 UTC
When some custom .desktop file sets StartupWMClass for its application and also sets an icon file for it, Task Switcher isn't picking up that association and on Wayland for example is using a generic Wayland icon. I tested it with Breeze and Cover Switch task switchers, both demonstrated this problem.

In comparison, Task Manager does read it correctly and sets the icon properly accordingly, so something isn't done right with task switchers in particular.
Comment 1 Shmerl 2022-10-14 02:33:11 UTC
Here is how you can test it.

Create test.sh file like this: (let's say you place it in your $HOME/tmp/test.sh).


#!/bin/bash
kdialog --msgbox "Test!"


Then create a test.desktop (in $HOME file like this, assuming your user is named foobar and assuming this icon is present on your system: /usr/share/icons/breeze/status/64/dialog-error.svg):


[Desktop Entry]
Encoding=UTF-8
Value=1.0
Type=Application
Name=Test 1
GenericName=Test 1
Comment=Test 1
Icon=/usr/share/icons/breeze/status/64/dialog-error.svg
StartupWMClass=org.kde.kdialog
Exec="/home/foobar/tmp/test.sh"


Then run kbuildsycoca5 to update your launchers and icons cache.

Start Test 1 from the launcher (like with krunner or etc.) and observe that Error icon is displayed in Task Manager, but not in Task Switcher.
Comment 2 Shmerl 2022-10-14 02:34:57 UTC
I meant you should create test.desktop in $HOME/.local/share/applications
Comment 3 Bug Janitor Service 2022-10-14 10:55:28 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kdialog/-/merge_requests/15
Comment 4 Nicolas Fella 2022-10-14 11:33:58 UTC
StartupWMClass is a X11 concept, so for Wayland-native windows ignoring it is kind of expected. For Wayland windows we expect what they pass to set_app_id to match the name of their desktop file. If that's not the case then the app needs to be fixed
Comment 5 Nicolas Fella 2022-10-14 11:36:26 UTC
The task manager has some heuristics to fix up misbehaving apps that the window switcher doesn't have. Unifying that could make sense, but if apps did the right thing by themselves it wouldn't be needed at all
Comment 6 Shmerl 2022-10-14 15:54:22 UTC
Making it dependent on the application only removes the ability to set custom icons which otherwise are possible with StartupWMClass. So I think flexibility of that is valuable.
Comment 7 Nate Graham 2022-10-14 19:47:49 UTC
The fixup heuristics should probably be shared between the Task Manager and the tabbox, yeah.

I agree that in an ideal world apps would always do the right thing, but... well... you know. :)
Comment 8 Nicolas Fella 2022-11-13 17:02:10 UTC
Git commit d6b62a7fe914ae153dde4a374e57a6c854e288cd by Nicolas Fella.
Committed on 13/11/2022 at 17:01.
Pushed by nicolasfella into branch 'master'.

Add desktop file

This is needed to get a window/taskbar icon on Wayland

NoDisplay since we don't want it to show up in launchers

M  +2    -0    src/CMakeLists.txt
A  +6    -0    src/org.kde.kdialog.desktop

https://invent.kde.org/utilities/kdialog/commit/d6b62a7fe914ae153dde4a374e57a6c854e288cd
Comment 9 Shmerl 2023-04-11 19:48:31 UTC
Just FYI, this still happens with 5.27.3. Didn't test 5.27.4 since it's not in Debian yet.
Comment 10 Nate Graham 2025-01-14 18:41:14 UTC

*** This bug has been marked as a duplicate of bug 459735 ***