LinuxCommandLibrary

handlr

There is no standard Linux command "handlr"

TLDR

Open a URL in the default application

$ handlr open [https://example.com]
copy

Open a PDF in the default PDF viewer
$ handlr open [path/to/file.pdf]
copy

Set imv as the default application for PNG files
$ handlr set [.png] [imv.desktop]
copy

Set MPV as the default application for all audio files
$ handlr set '[audio/*]' [mpv.desktop]
copy

List all default apps
$ handlr list
copy

Print the default application for PNG files
$ handlr get [.png]
copy

SYNOPSIS

handlr [OPTION...] SUBCOMMAND [ARG...]

PARAMETERS

open [FILE]...
    Open files or stdin with default handler

get MIME...
    Print default handler(s) for MIME type(s)

set MIME DESKTOPFILE...
    Set DESKTOPFILE as handler for MIME

prefs [MIME]...
    Open MIME-type preferences pane

list [MIME]...
    List known MIME types and handlers

--list-files, -l
    List all known desktop files

--print, -p
    For get, print MIME type too

--user, -u
    Operate on user overrides

--system, -s
    Operate on system defaults

--list-all, -a
    For list, show all MIME types

--raw, -r
    Print raw desktop entry ID

--help
    Display help and exit

--version
    Output version information

DESCRIPTION

Handlr is a versatile command-line utility for managing MIME type associations and desktop file handlers on XDG-compliant Linux systems.

It provides essential subcommands like open to launch files or stdin with default applications (emulating xdg-open), get to retrieve default handlers for MIME types, set to assign new desktop file handlers, prefs to launch MIME preferences GUIs, and list to enumerate MIME types with their associated applications.

Global options enable targeting user (~/.local/share/applications) or system (/usr/share/applications) databases, listing all desktop files, printing raw entry IDs, or showing extended MIME info. Handlr simplifies scripting file operations, querying associations, and customizing defaults without graphical intervention, making it ideal for automation, dotfile management, and terminal workflows.

CAVEATS

Not installed by default; install via AUR/package manager. Requires update-desktop-database for changes. User overrides take precedence over system.

EXAMPLES

handlr open document.pdf
Opens PDF with default viewer.

handlr get image/png
Retrieves default image handler.

handlr set text/plain vim.desktop
Sets Vim for plain text files.

HISTORY

Developed by Philipp A. for Arch Linux (AUR package since ~2020). Evolved as a modern, feature-rich xdg-mime alternative focusing on desktop files and CLI usability.

SEE ALSO

xdg-open(1), xdg-mime(1), xdg-settings(1), mimeopen(1), gio(1)

Copied to clipboard