LinuxCommandLibrary

gvfs-mime

Set or get default application for MIME type

SYNOPSIS

gvfs-mime --query MIME_TYPE
gvfs-mime --set MIME_TYPE APPLICATION_HANDLER
gvfs-mime --list
gvfs-mime [--help | --version]

PARAMETERS

--query MIME_TYPE
    Queries and prints the default application for the specified MIME type.

--set MIME_TYPE APPLICATION_HANDLER
    Sets the default application for the specified MIME type. APPLICATION_HANDLER is typically a desktop file ID (e.g., firefox.desktop).

--list
    Lists all known MIME types and their currently configured default applications.

--help
    Displays a help message and exits.

--version
    Shows the program's version information and exits.

DESCRIPTION

gvfs-mime is a command-line utility provided by the GVfs (GNOME Virtual File System) suite. It allows users to interact with the system's MIME type database, primarily for querying and setting default applications. This tool is instrumental in defining which application opens specific file types (e.g., PDFs, images, text files) within a GNOME desktop environment or other environments utilizing GVfs.

It can list all known MIME types and their associated default handlers, query the specific default application for a given MIME type, or explicitly set a new default application for a MIME type. While it directly manages GIO/GVfs MIME associations, its functionality often aligns with the user's perception of 'default applications' on their desktop.

CAVEATS

gvfs-mime primarily manages associations within the GIO/GVfs framework, commonly used in GNOME and related desktop environments. Its effects might not be universal across all Linux desktop environments (e.g., KDE Plasma often uses different mechanisms).

When using --set, the APPLICATION_HANDLER must be the correct desktop file ID (e.g., org.gnome.Nautilus.desktop), not the raw executable path, which can sometimes be a source of confusion.

INTEGRATION WITH DESKTOP ENVIRONMENTS

While a command-line tool, gvfs-mime serves as the underlying mechanism for many GUI-based 'Default Applications' settings within GNOME and other GIO-based desktop environments. Users interacting with these graphical settings are often implicitly using the same GIO/GVfs mechanisms that gvfs-mime exposes.

USER-SPECIFIC CONFIGURATION

Default application settings managed by gvfs-mime are typically stored in the user's configuration directory, specifically ~/.local/share/applications/mimeapps.list. This allows for personalized application preferences without affecting system-wide defaults.

HISTORY

gvfs-mime is part of the GVfs (GNOME Virtual File System) project, which was introduced to GNOME to replace the older GnomeVFS. GVfs is a userspace virtual filesystem providing GIO (Gnome Input/Output) modules and various backends. gvfs-mime emerged as the command-line utility for managing MIME type associations within this new GIO/GVfs framework, offering programmatic control over default application settings that were previously handled differently in older GNOME versions or entirely by desktop environments. Its development is tied directly to the evolution of GNOME's core infrastructure for file handling and application launching.

SEE ALSO

xdg-mime(1), file(1), mimeopen(1)

Copied to clipboard