Repository navigation
Conversation
Load settings from ~/.config/onefetch/config.jsonc (JSONC, with $schema, logo, display, general and modules sections, like fastfetch). The modules list sets which fields are shown and in which order. Options given on the command line override the file. New flags: --config, --gen-config, --gen-config-full, --gen-config-force and --list-config-paths. Adds a JSON schema and a wiki page. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
o2sh
marked this pull request as draft
November 7, 2026 13:08
Add display.separator, display.key.width and display.key.paddingLeft, and per-module key, keyColor and outputColor options, so the label, colors and alignment of each info line can be changed from the config file. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Colors can be written as names (black to white, light_black to light_white, any case) as well as numbers from 0 to 15. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Onefetch can now read its settings from a config file.
~/.config/onefetch/config.jsonc(or$XDG_CONFIG_HOME/onefetch/config.jsonc). It's JSONC, so comments and trailing commas are allowed. Unknown keys are an error.$schema,logo,display,general,modules.modules: lists the fields to show, in order. An entry is a name ("head") or an object with options ({"type": "authors", "number": 5, "email": true}), and a field left out is hidden. This also makes field order configurable for the first time.logo:nullhides it,"rust"is a shorthand, andtype/sourceacceptauto,builtin,data,file,kitty,sixel,itermandnone.display.separatorsets the text between a key and its value (default": ").display.key.widthpads keys so values line up in a column, anddisplay.key.paddingLeftindents the keys. Every module excepttitleandcolorsalso acceptskey(a custom label),keyColorandoutputColor, for example{"type": "head", "key": "Tip", "keyColor": 9}. These options exist only in the config file, with no command-line flags.New flags:
--config <CONFIG>-for stdin, ornone--gen-config [PATH]-prints it.--gen-config-full [PATH]--gen-config-force [PATH]--list-config-pathsGenerated configs include the current command-line options.
Also adds a JSON schema (
docs/json_schema.json) for editor completion, a wiki page (docs/wiki/configuration.md), and updates to the README and ARCHITECTURE.md.Why
To keep settings without a shell alias full of flags.
Notes for reviewers
-cshort flag:--configis long-only, since-calready means--ascii-colors.Clifields that the command line didn't set, checked with clap'svalue_source. Everything after that is unchanged.InfoArgshas a newfields: Option<Vec<FieldKind>>(#[arg(skip)]), set only bymodules. The builder sorts fields by it, and--disabled-fieldsstill filters on top.UNSET_COLOR(u8::MAX), andTextColorsandget_ascii_colorsgive that slot its default color. The command line can't produce this value because it only accepts 0 to 15.RenderOptions::key_layout(KeyLayout), stored inTextFormattingArgsas an#[arg(skip)]field and set only by the config.field_linesbuilds each line's prefix from the left padding, key and separator, and pads it towidth. With the default layout the output is unchanged. Per-line colors use two new styles,Style::KeyColor(n)andStyle::ValueColor(n).outputColoronly recolors plain value text, so language chips, bars and the activity graph keep their colors.titleandcolorsinmodulesturn the title and the palette on or off, but they always print first and last.json-strip-commentsfor comments and trailing commas. Its only dependency, memchr, was already in the tree.docs/onefetch.1was not regenerated, because help2man isn't available here.🤖 Generated with Claude Code