Hello, I’d like to get some help with an issue I’m facing, xdg-open opens pdf docs and plain text in firefox. Tried editing the ~/.config/mimeapps.list with no luck
Sorry, “not working” doesn’t tell us anything. Please edit your topic title to be clear and concise about the issue you’re having.
What did you edit? You should normally not edit that file as it’s automatically generated.
Either way, you posted the wrong section of the file. application/pdf is under [Added Associations], not [Default Applications].
By the way, there’s no reason to post a whole section of the file if all you’re concerned about is one file type. grep is your friend.
Example on my system:
❯ grep pdf ~/.config/mimeapps.list
application/pdf=org.gnome.Evince.desktop;
In the future, please use proper formatting, using blockquote for terminal or file output is not appropriate. Neither is posting screenshots. I’ve removed your screenshot above.
Tip: The more effort you put into your topic, the more effort helpful volunteers will provide.
Forgive me for stating the obvious, but if you do not have a nano.desktop file (typically in /usr/share/applications/ or ~/.local/share/applications/), then of course you will be unable to use xdg-open to open text files with nano.
I have no experience with Sway, so I do not know the best approach for your situation. But sure, just follow the Desktop Entry Specification.
You may be able to use another application’s existing .desktop file as a guide. As omano noted, nano is a terminal application, so may require an approach like in these Arch Linux forum threads about vim.
Thanks for pointing that out, I just pretty much copied vim’s desktop entry and created a nano.desktop file. I had to change the corresponding entries:
After that I set: xdg-mime default nano.desktop text/plain
And when running: xdg-mime query default text/plain
I get: nano.desktop
Now xdg-open file.txt works with nano
Thank you very much for your help, the problem was that there was no nano.desktop file created. Don’t know why though.
Hello: xdg-mime default org.pwmt.zathura.desktop application/pdf
Set zathura as default pdf viewer. Firefox does not open pdf files by default anymore. Thank you very much for your help.