handlr
There is no standard Linux command "handlr"
TLDR
Open a URL in the default application
Open a PDF in the default PDF viewer
Set imv as the default application for PNG files
Set MPV as the default application for all audio files
List all default apps
Print the default application for PNG files
SYNOPSIS
handlr [GLOBAL_OPTIONS] SUBCOMMAND [SUBCOMMAND_OPTIONS] [ARGUMENTS]
handlr open [-ps] <PATH|URL>
handlr set <MIMETYPE|SCHEME> <APP_ID>
handlr get <MIMETYPE|SCHEME>
handlr list [<MIMETYPE|SCHEME>]
handlr launch <APP_ID>
handlr install <APP_ID>
handlr uninstall <APP_ID>
handlr select <MIMETYPE|SCHEME>
handlr [-h|--help|-V|--version|--list-schemes|--list-mime-types]
PARAMETERS
-h, --help
Displays a help message for the command or a subcommand and exits.
-V, --version
Prints version information for handlr and exits.
--list-schemes
Lists all registered URL schemes (e.g., http, mailto).
--list-mime-types
Lists all registered MIME types (e.g., text/plain, image/jpeg).
open <PATH|URL>
Opens a file or URL with its currently configured default handler.
Options:
-p, --prompt: Prompts the user to select an application if multiple handlers are available.
-s, --stream: Streams the content of a file to stdout (only for certain MIME types, like text).
set <MIMETYPE|SCHEME> <APP_ID>
Sets the default application for a specified MIME type or URL scheme. APP_ID is typically the desktop entry filename (e.g., firefox.desktop).
get <MIMETYPE|SCHEME>
Retrieves and prints the currently set default application for a given MIME type or URL scheme.
list [<MIMETYPE|SCHEME>]
Lists all applications associated with a specific MIME type or scheme. If no argument is provided, it lists all registered associations.
launch <APP_ID>
Launches a specific application directly by its desktop entry ID, without opening a file or URL.
install <APP_ID>
Installs a .desktop file (application launcher) into the user's local applications directory (~/.local/share/applications/), making it discoverable by handlr and the desktop environment.
uninstall <APP_ID>
Uninstalls a .desktop file previously installed by handlr install or manually placed in the user's local applications directory.
select <MIMETYPE|SCHEME>
Interactively presents a list of available applications and allows the user to select and set the default handler for a given MIME type or URL scheme.
DESCRIPTION
handlr is a command-line tool designed to streamline the management of default applications for file types (MIME types) and URL schemes on Linux. It offers a more intuitive and powerful alternative to traditional utilities like xdg-open and xdg-mime, which can sometimes be less user-friendly or consistent.
Written in Rust, handlr aims to provide a reliable and fast way to configure and use application handlers. It interacts directly with the freedesktop.org specifications, particularly the mimeapps.list standard, and desktop entry files (.desktop). Users can easily open files or URLs with their preferred applications, set new defaults, retrieve current handlers, list all known associations, and even launch specific applications or manage their desktop entries directly from the command line. Its focus on simplicity and adherence to modern Linux desktop standards makes it a valuable tool for both power users and those seeking a more consistent desktop experience.
CAVEATS
handlr relies on the freedesktop.org desktop entry and MIME type specifications. Its functionality is most robust in desktop environments that adhere to these standards and have a proper xdg-desktop-portal or similar infrastructure. In minimal or non-standard environments, some features, particularly open and launch, might not behave as expected or might require manual configuration of XDG_DATA_HOME and XDG_CONFIG_HOME paths.
While handlr aims for consistency, discrepancies can still arise if system-wide and user-specific mimeapps.list files or desktop entry caches are inconsistent or corrupted.
CONFIGURATION FILES
handlr primarily interacts with ~/.config/mimeapps.list for user-specific default associations and ~/.local/share/applications/ (and system-wide equivalents like /usr/share/applications/) for desktop entry files (.desktop). These files are central to how handlr discovers and manages applications.
USAGE EXAMPLES
- Set default browser: handlr set http firefox.desktop
- Open a file: handlr open document.pdf
- Get current handler for text files: handlr get text/plain
- List all available PDF viewers: handlr list application/pdf
- Interactively select image viewer: handlr select image/jpeg
HISTORY
handlr is a relatively new project, developed in Rust, addressing common frustrations with existing xdg-utils related to default application management. Its development was driven by a desire for a more modern, efficient, and user-friendly command-line interface for handling MIME types and URL schemes. It has gained popularity in the Linux community for its focus on simplicity and adherence to contemporary desktop standards, providing a more reliable and consistent experience compared to older shell-script based utilities.
SEE ALSO
xdg-open(1), xdg-mime(1), mimeopen(1), desktop-file-install(1), update-desktop-database(1)