Expand description
Which application opens a type, and changing it.
mimeapps.list is the freedesktop file that records the choice. It
is read from several places (the user’s own, then the system’s) and
written in exactly one: $XDG_CONFIG_HOME/mimeapps.list.
§This file is hand-edited, so it is edited by hand
CLAUDE.md’s rule about files-config.toml applies here with more
force, because this file is not ours: people put comments in it,
group related types together, and keep sections this code has never
heard of. with_default therefore changes one line and copies
every other byte through — no parse-and-reserialise, which would
silently reorder a person’s file and drop their notes the first time
they changed a default from a menu.
[Added Associations] and [Removed Associations] are read —
they change what a chooser may offer — and never written: adding or
removing an association is not something this suite has a reason to
do on anyone’s behalf. A section beyond those three is neither read
nor touched, which is the only safe thing to do with it.
Constants§
- ADDED_
SECTION - Applications a user added for a type beyond what the desktop entries themselves registered.
- REMOVED_
SECTION - Applications a user does not want offered for a type, whatever the desktop entry claims.
Functions§
- parse
- The
[Default Applications]entries of onemimeapps.list. - parse_
section - Any one section of a
mimeapps.list— or ofmimeinfo.cache, which has the same shape and is read by this too (seecrate::apps::parse_cache). - with_
default textwithmimeset to open inapp— the whole file back, one line different.- without_
default textwithmime’s default removed, orNonewhen it had none.