On my Lubuntu (18.10), xdg-open launches VLC Player when the file is not associated to any applications.
$ xdg-mime query filetype jquery.js application/javascript $ xdg-mime query default application/javascript # no output $ xdg-open jquery.js Error: no "view" mailcap rules found for type "application/javascript" Opening "/tmp/jquery.js" with VLC media player (application/javascript) On some files, it launches Calibre's E-book viewer (.rb for example).
EDIT I digged into xdg-open and found it executes following commands:
- Check filetype with
xdg-mime query filename "$file"andxdg-mime query default $filetype run-mailcap --action=view "$file"mimeopen -L -n "$file"
The problem lies in mimeopen.
Then how can I change mimeopen to open any unknown files with featherpad, or specific app? In other words, I'd like to set default fallback application if mimeopen can not find any suitable apps.
/usr/bin/xdg-open: it looks like it's unable to detect your desktop environment. Knowing the output ofecho $XDG_CURRENT_DESKTOPandecho $DESKTOP_SESSIONmight help. 2.1) It looks like it's runningrun-mailcapand thenmimeopen, (in a way that won't show you an application chooser), instead of running the file manager (pcmanfm, right?)./usr/bin/xdg-openand confirmed that it executesmimeopen -L -n "$file". Now I'm checkingmimeopento find reasons why VLC is associated to these files.xdg-openis not executingopen_lxde()you may want to try setting the environment variableXDG_CURRENT_DESKTOP=LXDE. This wayxdg-openshould try to callpcmanfminstead ofmimeopenand, if you are lucky (I'm not on LXDE, cannot test reliably), the file manager could ask you how to open files that have no explicit application association set.xdg-open,open_lxqtis just an alias ofopen_generic. I'll update my question based on our comments.