Bug 506836

Summary: Add a new 'Add to associations' checkbox in Choose Application
Product: [Plasma] xdg-desktop-portal-kde Reporter: Ben V <bencvdv>
Component: generalAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: wishlist CC: aleixpol, kde, nate
Priority: NOR    
Version First Reported In: 6.4.0   
Target Milestone: ---   
Platform: EndeavourOS   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Ben V 2025-07-10 03:53:01 UTC
SUMMARY
Currently the 'Open With' dialog allows setting the primary file association, through the `Always open <type> files with the chosen app` checkbox. I find that I frequently don't want to set the primary association, but simply want it to show up in the Open With options next time (i.e. append an association, rather than set the primary).

A common use-case for this is opening folders as a project in a particular application. If I right click a folder and say 'Open With', I may want to add a particular IDE to the associations without setting it as the default.

I'm aware that this can all be handled through the KDE System Settings. However it would be a great QoL feature if the user could add it within the current 'Open With' workflow, rather than needing to separately navigate into the settings.

I attempted to do this myself but ran into build errors when developing, so I'm just dropping it in as a wishlist item since I don't have enough time to sort out my dev environment. It's certainly possible, although it may be beneficial to also add a new utility function to KServices that allows adding an association (i.e. appending to the list rather than prepending), given that's where the primary logic exists for setting the preferred association. 

STEPS TO REPRODUCE
1. Right click on file or folder
2. Open folder with > other application

OBSERVED RESULT
Can only set a new application as the primary one.

EXPECTED RESULT
Can add as a new association without replacing the primary one.

SOFTWARE/OS VERSIONS
KDE Plasma Version: 6.4.0
KDE Frameworks Version: 6.15.0
Qt Version: 6.9.1
Kernel Version: 6.12.34-1-lts (64-bit)
Operating System: EndeavourOS
Comment 1 Nate Graham 2025-08-26 19:28:18 UTC
Are you seeing that apps capable of handling opening folders aren't appearing in the dialog? They should. And if they do, it's a matter of clicking on them, right?
Comment 2 Ben V 2025-08-26 22:33:32 UTC
(In reply to Nate Graham from comment #1)
> Are you seeing that apps capable of handling opening folders aren't
> appearing in the dialog? They should. And if they do, it's a matter of
> clicking on them, right?

Not absolutely sure what you're asking, so I'll try to elaborate with an example.

1. I have VSCode (arbitrary choice) installed on my system, and commonly wish to open up project folders in it for development.
2. I then right click > open with, and find that VSCode doesn't appear in the `Open With` list since the association doesn't yet exist.
3. I choose 'Other Application'. The 'Choose Application' dialog that pops up shows me all the existing associations, as well as an option to search for other applications.
4. Since VSCode isn't listed yet, I search for it and select it.
5. My project opens in VSCode.

So far this is all expected behaviour and an intuitive way of opening a folder in my 'new' choice of software. Now we proceed into the future, where I want to open it again.

5. Right click > open with... and vscode doesn't appear in the list? It seems selecting it previously did not add that association as I had hoped, so I need to go through the same process.

There are two primary ways to add this association (that I am aware of):

1. Through system settings
This is not ideal in the given situation, since it's not directly part of the process the user is going through. Unnecessary extra steps are required and, for those not familiar with all the system settings have to offer, may be quite an issue. (I can't imagine my grandmother naturally looking up the technical jargon 'File Associations' when the 'Open With' dialog failed to add an app to the associations).

2. In the Choose Application dialog, check the box "Always open <Folder> files with the chosen app". 
This successfully adds the association, but also sets my application as the *primary* application. If I choose to open a folder on my desktop, it will now open directly in VSCode instead of Dolphin.

My proposed solution is to replace the 'Always open <Folder>....' checkbox with the radio buttons:
-  "Associate <Folder> files with the chosen app". (add to the bottom of the associations list, rather than setting as primary)
- "Always open <Folder> files with the chosen app". (the behaviour of the existing checkbox, unchanged)
- "Do nothing" (default, presumably could be worded better).

If the user chooses the first option, the application will be added to the file associations. This way it will appear in the 'Open With' context menu in future.
Comment 3 Ben V 2025-08-26 22:36:42 UTC
I forgot to include, this proposal is not intended to replace the File Associations in system settings at all. If a user wishes to make significant changes to file associations, remove file associations, etc then that's all handled through the system settings. 

This is merely an attempt to add (what I believe to be) a common feature to be expected directly within the user flow when opening a file type with a new application :)
Comment 4 Nate Graham 2025-08-27 15:45:59 UTC
> 2. I then right click > open with, and find that VSCode doesn't appear in the `Open With` list since
> the association doesn't yet exist.
Aha, that's the problem: VSCode can in fact open folders, but doesn't advertise this in its .desktop file. It should! And you can edit its .desktop file yourself to tell the system that it can open folders.

What's requested here is a workaround for an app bug that should be fixed, and already has existing working workarounds; I'm not sure we should implement it as proposed, sorry! Please do report that issue to the VSCode folks, though.
Comment 5 Ben V 2025-09-02 01:07:31 UTC
> Aha, that's the problem: VSCode can in fact open folders, but doesn't
> advertise this in its .desktop file. It should! And you can edit its
> .desktop file yourself to tell the system that it can open folders.
> 
> What's requested here is a workaround for an app bug that should be fixed,
> and already has existing working workarounds; I'm not sure we should
> implement it as proposed, sorry! Please do report that issue to the VSCode
> folks, though.

Similar issues exist for all Jetbrains products, GitKraken, and numerous other dev tools that I use.

Whilst I understand that the "correct" route is for the owners of these tools to correct their desktop files, surely it is in the best interest of the end user to add this easy option as a workaround? It's a relatively basic feature that I'd expect to see, and was rather surprised when it didn't exist.

I don't think we should be compromising system usability simply because there is a "correct" way of doing it which clearly isn't being globally adhered to by application developers (and relatively large ones at that), to the detriment of KDE users. In my opinion the average user shouldn't need to be filing bug reports against these applications or manually finding and updating their own .desktop files, even if those more experienced with the technology should do so on behalf of the wider community.
Comment 6 Kai Uwe Broulik 2025-09-02 04:58:20 UTC
The easiest way to add an association is actually though the file properties dialog. 

Right click a folder -> Properties -> Open With App [Change] -> Add VS Code.

I believe the reason VSCode doesn't announce folders is that it doesnt want to steal the association from the file manager. There's no priority mechanism for an app to say "I can open this but please don't make me the default app for it". So if you installed VSCode chances are it would suddenly open all folders which is definitely not what we want.

It's also why when I added support for opening Windows ExE files I did not as it to its mime type list because I didn't want to potentially break everyone using Wine.
Comment 7 Ben V 2025-09-02 05:19:57 UTC
Exactly, hence the request. The current behaviour is to add as default only which prepends the app to the mimetype list, rather than just as another association which would append it. 

KServices needs that utility function included which behaves identically to 'add as primary' but appending instead, and then xdg-desktop-portal could utilise that function to add the option to simply add as an association.

Currently selecting the application through `Open With > Other` does not remember the association unless you explicitly mark it as primary, or go modifying file associations directly in the system settings.