main
fetch-snap
Absolutely worst piece of code, completely generated by AI to complete one single task - make fastfetch pictures.
Purpose
Render fastfetch output to an image (png, jpg, webp, gif) without losing any colors.
Install
Requires uv and fastfetch.
uv sync
Usage
uv run fetch-snap # fetch.png in the current directory
uv run fetch-snap -o snap.png # pick output file
The output format is taken from the file extension, or set with -f:
uv run fetch-snap -f jpg -o out.jpg
uv run fetch-snap -f webp -o out.webp
uv run fetch-snap -f gif -o out.gif
Options
| Flag | Description |
|---|---|
-o, --output |
Output file (default: fetch.<format>) |
-f, --format |
Image format: png, jpg, webp, gif |
--icon |
Fetch icon (logo), passed to fastfetch --logo, e.g. ascii, nerd_font |
--theme |
Kitty color theme name or .conf path |
--prompt |
Real shell prompt line: top, bottom or both |
--shell |
Fallback prompt style if the real prompt cannot be captured: bash, zsh, fish, nu, pwsh |
--raw |
Run the command directly, without shell alias expansion |
--bg |
Background color, e.g. #1e1e2e (default: dark gray, or the theme background) |
--scale |
Render scale, multiplies font size and padding (default: 2) |
--font |
Font path or fontconfig family name, e.g. "JetBrainsMono Nerd Font" |
--font-size |
Font size in px (default: 16) |
--padding |
Padding around the text in px (default: 14) |
--fastfetch |
Command to run instead of fastfetch |
Examples
# nerd font icons with a kitty theme and prompt lines
uv run fetch-snap --icon nerd_font --theme nord --prompt both -o snap.png
# custom background color and a sharper 4x render
uv run fetch-snap --bg "#241f31" --scale 4 -o snap.png
# use your own pretty fastfetch alias (aliases are expanded by default)
uv run fetch-snap -o snap.png
# skip alias expansion and call fastfetch directly
uv run fetch-snap --raw -o snap.png
# prompt two ways
uv run fetch-snap --prompt top --shell zsh -o snap.png
uv run fetch-snap --prompt bottom --shell fish -o snap.png
Notes
- The output is captured through a pty so fastfetch keeps its colors. The
real terminal is detected (process tree, like
detect_os.pydoes) and the capture names itself after it, so modules liketerminalfontand{$MY_TERMINAL}-style configs show your actual terminal and font. - Without
--raw, the command runs through an interactive shell, so your.bashrcaliases apply. --promptrenders your real shell prompt: the shell itself is started interactively in a pty and the prompt it prints is captured, colors included. If that fails, a synthetic prompt is used instead. Withtoporboth, the typed command line (e.g.fastfetch --logo nerd_font) is shown after the prompt at the top; the bottom only gets the prompt.- If no
--themeis given, colors are read from~/.config/kitty/kitty.confand your terminal's background/foreground. - Fonts: a nerd font is preferred when installed; missing glyphs fall back per-character to any font that covers them, so nerd icons and emoji render even if your main font lacks them.
- The resolved fonts are printed to stderr, e.g.
font: .../SomeNerdFont.ttf.
Description
Absolutely worst piece of code, completely generated by AI to complete one single task - make fastfetch pictures.
46 KiB
0 Stars
1 Watchers
0 Forks
Languages
Python
100%