[][src]Crate xdg_utils

Query system for default apps using XDG MIME databases.

The xdg-utils library provides dependency-free (except for std) Rust implementations of some common functions in the freedesktop project xdg-utils.

What is implemented?

  • Function query_default_app performs like the xdg-utils function binary_to_desktop_file
  • Function query_mime_info launches the mimetype or else the file command.

Some of the utils may be implemented by combining these functions with other functions in the Rust standard library.

NameFunctionImplemented functionalities
xdg-desktop-menuInstall desktop menu itemsno
xdg-desktop-iconInstall icons to the desktopno
xdg-icon-resourceInstall icon resourcesno
xdg-mimeQuery information about file type handling and install descriptions for new file typesqueries only
xdg-openOpen a file or URL in the user's preferred applicationall (combine crate functions with std::process::Command)
xdg-emailSend mail using the user's preferred e-mail composerno
xdg-screensaverControl the screensaverno

Specification

https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html

Reference implementation

https://cgit.freedesktop.org/xdg/xdg-utils/tree/scripts/xdg-utils-common.in

Functions

query_default_app

Returns the command string of the desktop file that is the default application of given MIME type query

query_mime_info

Returns the MIME type of given file https://cgit.freedesktop.org/xdg/xdg-utils/tree/scripts/xdg-mime.in