-
Notifications
You must be signed in to change notification settings - Fork 408
Configuration
Carter Li edited this page Jul 17, 2024
·
12 revisions
Fastfetch uses JSONC (JSON with comments) to store configuration. It should be located in ~/.config/fastfetch
, named config.jsonc
(NOT ). You may create it with config.json
fastfetch --gen-config
. A simplest JSONC file should be like
// ~/.config/fastfetch/config.jsonc
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"modules": [
"title",
"separator",
"module1",
{
"type": "module2",
"module2-option": "value"
}
]
}
Using an editor with JSON schema support is highly suggested. If unsure, I suggest using vscode.
# Make sure that `~/.config/fastfetch/config.jsonc` doesn't exist
fastfetch --whatever-flags --gen-config
We had command line, flag based configuration for long time. Why bother introducing a new config format?
- JSON is standard. Most IDEs have builtin support of syntax highlighting, validation and formatting, without additional requirements.
- JSON is structure based. It's easier to read with proper indentation.
- With JSON schema, you get on-the-fly IDE intelligence when typing.
- JSON supports array. Print one module mutiple times without hacking the command line flags.
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.
*.jsonc
in https://github.com/fastfetch-cli/fastfetch/tree/dev/presets/examples
You may test it with fastfetch --config examples/x.jsonc
- Mixing command line flags with
config.jsonc
may / may not work. Generally, module command line option flags won't work whenconfig.jsonc
won't work. Other flags should work. - Special charactors should be encoded as
\uXXXX
in JSON. Notably,\e
or\033
should be\u001b
.