At work, I run archlinux in WSL. I would like to use kde-open to open files from the terminal. Right now, it opens everything in windows programs (notepad, edge etc.) even if I have corresponding linux programs (gvim, okular) installed. Is there a way to make kde-open prioritise my preferred programs inside wsl? (I see that xdg-open does the same)
I do realise this might be an XY problem, so if there is different command that works better than kde-open, that would be fine too.
What I can see is that xdg-mime works correctly. For instance, the command xdg-mime query default "$(xdg-mime query filetype test.txt)" gives vim.desktop as the correct output. Yet, xdg-open test.txt opens the file in notepad.
It is worth mentioning that XDG_CURRENT_DESKTOP is not set by WSL because it is not being run inside a desktop environment.
You are correct that xdg-open is detecting wsl. If I run env XDG_UTILS_DEBUG_LEVEL=10 xdg-open test.txt, then it shows Selected DE wsl. Same with replacing xdg-open with kde-open.
If I run kioclient exec test.txt, I see the Choose Application - KIO Client dialog. No apps are shown in the list though. I can select /usr/bin/gvimand it opens the file correctly. However, it does not remember the selection despite selecting the checkbox to Remember application association for all files of type “Plain text document” (text/plain).