handlr: Manage your default applications


Introduction

handlr lets you manage your system’s default applications from the command line. It’s handy when you want a specific app to handle a certain file type or URL without digging through desktop environment settings.

Quick start examples

  • Open a URL in the default application:
handlr open {{https://example.com}}
  • Open a PDF with the default PDF viewer:
handlr open {{path/to/file.pdf}}
  • Set a specific app for PNG files (example uses imv):
handlr set {{.png}} {{imv.desktop}}
  • Set MPV as the default for all audio files:
handlr set {{'audio/*'}} {{mpv.desktop}}
  • List all default applications:
handlr list
  • Print the default application for PNG files:
handlr get {{.png}}

What these commands do

  • handlr open: hands off opening a resource with the app you’ve chosen as default. Use with URLs or local files.
  • handlr set: assign a default handler for a MIME type or file pattern to a specific .desktop entry.
  • handlr list: quickly audit which apps are configured as defaults.
  • handlr get: verify the current handler for a given type.

Common pitfalls and tips

  • Correct desktop file names matter. Use something like imv.desktop or mpv.desktop exactly as shown in your system’s .desktop files. The name must match the desktop entry.
  • MIME patterns vs. extensions: ‘audio/*’ covers all audio formats; a specific extension like ‘.png’ must be used with the dot notation shown ({{.png}}).
  • Quoting matters for wildcards. When using patterns, keep them inside {{}} and quote as needed, e.g., {{‘audio/*’}}.
  • Environment differences: handlr relies on your system’s desktop environment and its mime/apps database. If a change doesn’t take effect, try refreshing the MIME database or restarting the session.
  • When debugging, list first to confirm current defaults, then get to confirm a target is set correctly.

Common use cases

  • Open an external link in your preferred browser:
handlr open {{https://example.com}}
  • Make VLC handle video files:
handlr set {{'video/*'}} {{vlc.desktop}}
  • Check what PNGs currently use as their handler:
handlr get {{.png}}

Where to go from here

  • Explore your installed .desktop files under /usr/share/applications or ~/.local/share/applications to find valid targets.
  • If handlr commands don’t seem to apply, ensure you have the latest cache. In some setups, you may need to update the tldr cache or refresh your environment to pick up changes.

References

See Also