Skip to content

Linuxdrito/fetchlains

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fetchlains

fastfetch + lain gifs for my Hyprland setup.

The original zsh script worked fine, but I wanted to eliminate shell overhead and take advantage of the fact that fastfetch and GIF selection can run in parallel..

lain10 lain1


What it does

  1. Immediate fork — launches fastfetch in the background, redirecting its output to a tmpfile, without waiting.
  2. In parallel — reads ~/.gif-index and picks a random GIF with its precomputed dimensions.
  3. Sync — waits for fastfetch, clears the screen, dumps the output.
  4. Terminal detection — checks $KITTY_WINDOW_ID, $TERM, $TERM_PROGRAM and picks kitty or sixel protocol. Defaults to kitty (GPU accelerated).
  5. execlp timg — replaces the process itself with timg (no extra fork, no zombie process). Animated GIF with --loops 0. Press q to quit and free resources.

Files

fetchlains.c        — source
fetchlains.sh       — original zsh script (reference)
gif-index      — GIF index with precomputed dimensions → copy to ~/.gif-index
margin.txt     — fastfetch logo → copy to ~/margin.txt


Dependencies

fastfetch timg gcc

Setup

# 1. Place the index
mkdir ~/Descargas && cp -r ~/fetchlains/gifs ~/Descargas/

# 2. Place the index
cp gif-index ~/.gif-index

# 3. Place the logo
cp margin.txt ~/margin.txt

# 4. Compile
gcc -O2 -march=native -flto -pipe -s -o fetchlains fetchlains.c

# 5. Install
sudo mv fetchlains /usr/local/bin/fetchlains

gif-index

Format: name.gif:width:height. One GIF per line, no spaces.

lain-gift.gif:36:36
lain8.gif:33:33
lain9.gif:37:37
lain1.gif:35:35
lain10.gif:35:35
lain2.gif:35:35
lain4.gif:35:35
lain5.gif:35:35

GIFs live in ~/Descargas/gifs/. To add a new one just append a line to the index — no recompilation needed.


Hyprland integration

In hyprland.conf:

bind = $mainMod, H, exec, footclient fetchlains

Why not the zsh script

fetchlains.sh fetchlains (C)
Startup overhead ~15ms (zsh) ~1ms
fastfetch + GIF selection Sequential Parallel
Launching timg fork + exec execlp (replaces the process)
GIF dimensions case at runtime Read from index
Terminal protocol sixel hardcoded Auto-detected (kitty/sixel)
Quit Ctrl+C q

About

El fastfetch con los gifs de lain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors