menuinst
menuinst copied to clipboard
Fix `xdg-mime` default registration
Description
Closes #226. Instead of using xdg-mime default, we edit mimeapps.list manually. If an application is already registered as default, we won't override it. We always populate the "Added associations" list with our desktop file so it's there in the "open with" menu. We also handle cleanups now.
Checklist - did you ...
- [x] Add a file to the
newsdirectory (using the template) for the next release's release notes? - [ ] Add / update necessary tests?
- [ ] Add / update outdated documentation?
@mrclary could you check if this PR fixes your Linux issues? Thanks!
@jaimergp, sorry for the late follow up. I've been sick all last week. So a few observations with this branch:
- Using the test JSON file I can reproduce your results and see FileTypeAssociation in the available applications list
- Removing
%ffrom the Linux platform command (i.e.import sys, pathlib as p; p.Path(r'__OUTPUT_FILE__').write_text(r'')) results in FileTypeAssociation not available in the applications list. - Removing
MimeTypeandglob_patternsdoes not affect the result - Modifying the command in any way does not affect the result, as long as
%fis somewhere in the command. e.g."command": ["%f"]withoutMimeTypeorglob_patternsworks
Perfect! I'm reading this as "it works as long as %f is present in some way", so I added a note to the docs. In that case, I think this is ready to go, right?
Okay, I'm a bit embarrassed. I was not aware of the %f requirement, and Spyder appears in the applications list even for menuinst=2.1.1 if %f is included in the command. I apologize for the inconvenience; perhaps this PR was not necessary. Nevertheless, everything seems to be working as expected.
I did find a couple bugs and polished the cleanup, so no worries, it was indeed useful! Glad you made it work too.