Xdg-utils: Difference between revisions
From wikinotes
Line 7: | Line 7: | ||
<blockquote> | <blockquote> | ||
{| class="wikitable" | {| class="wikitable" | ||
|- | |||
| [[XDG Base Directory]] || my notes | |||
|- | |- | ||
| <code>man xdg-mime</code> || https://manpages.debian.org/buster/xdg-utils/xdg-mime.1.en.html | | <code>man xdg-mime</code> || https://manpages.debian.org/buster/xdg-utils/xdg-mime.1.en.html |
Latest revision as of 23:31, 20 July 2021
xdg-utils is a commandline tool to open/set default programs for mimetypes.
It operates using the XDG Mime Applications system.
See Also mimetypes.
Documentation
XDG Base Directory my notes man xdg-mime
https://manpages.debian.org/buster/xdg-utils/xdg-mime.1.en.html gitlab https://gitlab.freedesktop.org/xdg/xdg-utils cgit mirror https://cgit.freedesktop.org/xdg/xdg-utils/
Usage
Open
# use default program to open URI xdg-open [URI] # use default application toQuery
xdg-mime query default text/plain # query default program for mimetype xdg-mime query default file.pdf # query default program for file xdg-mime query filetype photo.jpeg # query mimetype of file # set to show files involved in choosing application env XDG_UTILS_DEBUG_LEVEL=10 \ xdg-mime query default text/htmlSet Default
xdg-mime default feh.desktop image/jpeg
Special Cases
xdg-open URL
2021/05/08 there is a bug in xdg-open.
Workaround -- Set the PATH-like environment variable
${BROWSER}
to control xdg-open's behaviour.If a url is provided, the scheme is extracted using sed, and
x-scheme-handler/${SCHEME}
is tried.
Unfortunately, withinopen_generic_xdg_mime()
, it re-tries the obtaining the mimetype and fails.