std.mime — Lilush API

←index

← std

Overview

MIME type detection and default application lookup based on file extensions and XDG desktop entries.

Functions

NameSignature
mime_typemime_type(filename) -> mime
mime_default_appmime_default_app(m_type) -> app
mime_infomime_info(filename) -> info

mime_type(filename) -> mime

Detect the MIME type of a file based on its extension

mime_default_app(m_type) -> app

Find the default application for a MIME type

Searches XDG mimeapps.list files for the default .desktop entry associated with the given MIME type. Checks user, local, system, and XDG config locations in order of priority.

mime_info(filename) -> info

Get MIME type, default application, and command line for a file

Returns a table with fields: type (MIME type string), default_app (.desktop filename), cmdline (Exec line from the .desktop file, or "xdg-open" as fallback).