Skip to content

Configuration

Carter Li edited this page Aug 7, 2023 · 12 revisions

JSON based configuration

Fastfetch uses JSONC (JSON with comments) to store configuration. It should be located in ~/.config/fastfetch, named config.jsonc (NOT config.json). You may create it with fastfetch --gen-config jsonc. A simplest JSONC file should be like

// ~/.config/fastfetch/config.jsonc
{
    "$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json"
}

Using an editor with JSON schema support is highly suggested. If unsure, I suggest using vscode.

Why use JSON?

We had command line, flag based configuration for long time, so bother introducing a new config format?

  1. JSON is standard. Most IDEs have builtin support of syntax highlighting, validation and formatting, without additional requirements.
  2. JSON is structure based. It's easier to read with proper indentation.
  3. With JSON schema, you get on-the-fly IDE intelligence when typing.
  4. JSON supports array. Print one module mutiple times without hacking the command line flags.
image

Documentation

Refer to: https://github.com/fastfetch-cli/fastfetch/wiki/Json-Schema

Generated using json-schema-for-humans with

generate-schema-doc ~/fastfetch/doc/json_schema.json --config template_name=md Json-Schema.md

Also refer to fastfetch --help for more detailed explanation.

Note

  • When config.jsonc is found, config.conf will be ignored
  • Mixing command line flags with config.jsonc may / may not work. Generally, module command line option flags won't work when config.jsonc won't work. Other flags should work.