The xdg-mime command, which is part of the xdg-utils package, can be used to define default application associations via
the XDG MIME Applications specification.
https://wiki.archlinux.org/title/Default_applications https://wiki.archlinux.org/title/XDG_MIME_Applications
- Query the MIME type of a file:
xdg-mime query filetype <path-to-file>
- Display the default application for PDFs:
xdg-mime query default application/pdf
- Find the desktop entry name of Firefox:
ls -l /usr/share/applications | grep -i firefox
- Set Firefox as the default application for html files:
xdg-mime default firefox.desktop text/html