SUMMARY ktraderclient5 ignores ~/.config/mimeapps.list when XDG_CURRENT_DESKTOP=KDE, it only shows XDG entries in .desktop files. When the env var is set to anything else, it correctly shows both the mimeapps.list and .desktop entries. STEPS TO REPRODUCE 1. XDG_CURRENT_DESKTOP="KDE" /usr/bin/ktraderclient5 --mimetype application/x-7z-compressed 2. XDG_CURRENT_DESKTOP="all" /usr/bin/ktraderclient5 --mimetype application/x-7z-compressed SOFTWARE/OS VERSIONS Operating System: Arch Linux KDE Plasma Version: 5.17.5 KDE Frameworks Version: 5.66.0 Qt Version: 5.14.1 ADDITIONAL INFORMATION This ends up breaking xdg-mime as it relies on ktraderclient5 https://gitlab.freedesktop.org/xdg/xdg-utils/issues/164
Created attachment 125545 [details] ktraderclient5 with 'KDE' and 'all' in XDG env var Refer to the linked xdg-utils Issue to see how to create a relevant .desktop entry if needed
I forgot to add that using XDG_CURRENT_DESKTOP="" is also broken and only ends up showing .desktop entries just like "KDE" does.
Empty env var probably has identical behavior because of currentDesktops.append(&kde); in KService:src/services/kservice.cpp Seems like the XDG var is also used in KService:src/sycoca/kmimeassociations.cpp The ktrader app itself is in https://invent.kde.org/plasma/kde-cli-tools/-/blob/master/ktraderclient/ktraderclient.cpp but it seems pretty barebones and relying on KService I haven't been able to figure out more so far.
After a debugging session with Martin, it turns out the desktop file not showing up under XDG_CURRENT_DESKTOP=KDE has NotShowIn=KDE, therefore this is behaving exactly as it should. Removing the line "fixes" it (allows it to show up under KDE again). Marking as not a bug.
Since the NotShownIn behavior is as expected, I opened a more proper issue here https://bugs.kde.org/show_bug.cgi?id=427469 per Jan's advice