-
Notifications
You must be signed in to change notification settings - Fork 464
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.
![image](https://private-user-images.githubusercontent.com/6134068/253265732-60159686-9b9f-4500-b87b-b5181279f7f6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNDkwNDMsIm5iZiI6MTczOTA0ODc0MywicGF0aCI6Ii82MTM0MDY4LzI1MzI2NTczMi02MDE1OTY4Ni05YjlmLTQ1MDAtYjg3Yi1iNTE4MTI3OWY3ZjYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMjEwNTQzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzdkN2FiMmE1NTI4YTJiZTU5ZWI1ZTZmNmZhZjU3YTg0NTQxODBlNWU0YjJmMjQyODZhOGIyNGE4YzYwZmU4NSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.lDswZ9d7bDM7HmRFPXFpFhuDQIhwqBLQXK-0FpMTRPY)
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
.