Skip to content

Latest commit

 

History

History
122 lines (92 loc) · 4.11 KB

File metadata and controls

122 lines (92 loc) · 4.11 KB

xfetch Config Generation (--gen-config)

xfetch --gen-config generates a starter config file so you can run and customize xfetch without hand-writing one. It writes a ready-to-use template and, when network is available, attaches the ASCII logo of your OS/distro.

Basic Usage

Generate the config at the default location (~/.config/xfetch/config.jsonc on Linux, ~/Library/Application Support/xfetch/config.jsonc on macOS, %APPDATA%\xfetch\config.jsonc on Windows):

xfetch --gen-config

Generate it somewhere else:

xfetch --gen-config --config ~/my-setup/xfetch-config.jsonc

Distro Logo (--logo)

By default the generated config includes the ASCII logo of the detected OS/distro, fetched from the xfetch-cli/logos catalog.

Automatic Detection

The detection reads /etc/os-release (ID + ID_LIKE) on Linux, and maps the OS version on macOS (macos-ventura, ...) and Windows (windows-11, ...). Resolution order: exact ID → each ID_LIKE token → generic logo of the category.

The fetched art is stored in <config_dir>/xfetch/logos/<distro-id>.txt and the generated config references it via the ascii key:

{
    "ascii": "/home/jan/.config/xfetch/logos/ubuntu.txt",
    "layout": "pacman",
    // ...
}

Logo Override

Choose a specific logo with --logo, overriding the detected OS/distro. Any catalog id or alias works, including logos of other OSes:

# Ubuntu machine, Arch logo
xfetch --gen-config --logo arch

# Force a specific OS/version logo
xfetch --gen-config --logo windows-11
xfetch --gen-config --logo macos-ventura

Fallbacks

  • Unknown --logo id: warns and uses the generic logo of the current category, saved as default.txt.
  • No network / catalog error / invalid art: the template is written without a logo — the previous behavior. Automatic detection falls back silently; an explicit --logo prints a warning.
  • Offline cache: once a logo is downloaded it stays in <config_dir>/xfetch/logos/, so regenerating later references the same file even without internet.

The catalog base URL can be overridden for testing forks or mirrors:

XFETCH_LOGOS_URL=https://raw.githubusercontent.com/<user>/logos/main \
    xfetch --gen-config --logo arch

Layout (--layout)

The template ships with the section layout (grouped Hardware/Software/Session modules). Use --layout to generate it with any of the built-in layouts (see LAYOUTS.md):

xfetch --gen-config --layout pacman
xfetch --gen-config --layout tree
xfetch --gen-config --layout compact

Available layout names:

  • default, side-block, tree, section, section-box
  • custom-x, compact, minimal
  • pacman, box, line, dots, bottom_line (classic variants)
  • horizontal, bottom (vertical layouts)

An unknown layout name warns and keeps pacman.

Combined Example

Generate a tree-layout config with the Arch logo on an Ubuntu machine:

xfetch --gen-config --layout tree --logo arch --config ~/configs/arch-tree.jsonc

The --logo and --layout flags only apply to --gen-config; runtime behavior is untouched.