Skip to content
  1. Docs
  2. Apps
  3. Developers

Files extensions

How to write, package and test an extension that adds context-menu actions and settings to Files.

Files can be extended with packages that contribute context-menu actions and typed settings. An extension is a small program, a worker, that Files runs when the user chooses one of its actions. This page describes the package format and the worker protocol. For installing and managing extensions as a user, see Files.

Trust model

  • Packages install disabled. Nothing runs at install time.
  • Updates must carry a newer version and are shown to the user for review.
  • Package files are checked against their SHA-256 hashes before every run.
  • Native workers run with the user's account permissions. They are not sandboxed, so users should install only extensions they trust.

Installed packages live in $XDG_DATA_HOME/files-app/extensions.

Package format

An extension is a .enzfiles file: a plain ZIP archive of at most 128 entries and 64 MiB, with a manifest.json at its root. The manifest must contain:

FieldMeaning
apithe extension API version
ida stable identifier
versionthe package version; updates must increase it
name, author, descriptionshown to the user during review
workerthe program to run
actionsthe context-menu actions the extension contributes

The full rules are in the JSON Schema shipped in the Files repository (docs/extensions.schema.json).

Workers

A worker is either a native program, declared with kind: "native", its program path and target, or one of the workers built into Files (kind: "builtin"). The bundled File checksums extension uses a built-in worker and demonstrates the action API.

Actions

An extension declares between 1 and 16 actions. Each action has a scope (files, folders, selection or background), can be limited to certain MIME types, and can bound how many items may be selected (0 to 128).

Settings and permissions

An extension can declare up to 16 settings of type toggle, text, integer or choice; Files shows them on the extension's page in Settings → Extensions and passes their values to the worker. Two permissions can be requested: clipboard and navigate.

Worker protocol

Files runs the worker once per action invocation.

  1. Files writes one JSON request to the worker's standard input. It contains the API version, the extension and action identifiers, the current folder, the selected paths, and the extension's settings. Paths are passed as raw bytes so that file names that are not valid UTF-8 survive intact.
  2. The worker writes one JSON object to standard output. It contains a message to show the user and whether to refresh the view, and, if the extension has the matching permission, text to put on the clipboard or a location to navigate to.
LimitValue
Request size2 MiB
Response size64 KiB
Standard error kept4 KiB
Run time60 seconds

The user can cancel a running action.

Example manifest

This is the manifest of the example extension in the Files repository:

json
{
  "api": 1,
  "id": "org.example.hello",
  "version": "1.0.0",
  "name": "Hello Files",
  "author": "Example author",
  "description": "A file action with a configurable greeting.",
  "worker": {"kind": "native", "program": "bin/hello", "target": "linux-x86_64"},
  "permissions": [],
  "actions": [
    {"id": "greet", "label": "Say hello", "icon": "message-circle",
     "scope": "selection", "max_selection": 32}
  ],
  "settings": [
    {"id": "greeting", "label": "Greeting", "value": {"type": "text", "default": "Hello"}}
  ]
}

Action icons are semantic enzUI icon names, not asset paths. A MIME filter is an optional mime array of exact types or a major-type wildcard such as image/*; every selected item must match it. The manifest target must match the worker's actual build target.

Build and check a package

The repository includes a Rust SDK under extensions/sdk, with no dependency on iced or enzUI. It defines the same request and response types Files uses and a bounded serve entry point. The complete example lives in extensions/examples/hello. To package it, build the worker, lay out the package directory, then let the Files binary pack and check it:

sh
./tools/build.sh build --locked --manifest-path extensions/examples/hello/Cargo.toml
mkdir -p dist
package="$(mktemp -d "$PWD/dist/hello.XXXXXX")"
mkdir "$package/bin"
cp extensions/examples/hello/manifest.json "$package/manifest.json"
cp "$CARGO_TARGET_DIR/debug/files-extension-hello" "$package/bin/hello"
"$CARGO_TARGET_DIR/debug/files-app" --extension-pack "$package" "$package.enzfiles"
"$CARGO_TARGET_DIR/debug/files-app" --extension-check "$package.enzfiles"

--extension-check is the authoritative validator, and packing refuses to overwrite an existing output. Install the result in Settings → Extensions, enable Hello Files, then right-click a file and choose Say hello.

Packages must be a single classic ZIP (no ZIP64 or multiple disks) with unique, relative paths: no absolute, parent or hidden paths, backslashes, links or special files. state.json is reserved.

Limitations

API version 1 supports context-menu actions and settings only. Extensions cannot add previews, thumbnails or sidebar entries.