Watch
1
0
Fork
You've already forked www.xengi.de
0
www.xengi.de/content/linux/pokeshell.md
Ricardo (XenGi) Band 29d565fd1c
idk..
2025-01-27 11:22:22 +01:00

1.2 KiB

title: Pokéshell date: 2016-01-01 23:30 category: linux tags: pokemon, shell, bash, fish, imagemagick, aur slug: pokeshell

A friend of me had the idea of a shell displaying a random pokémon on launch. I liked the idea and couldn't resist to implement it over christmas.

What the package does is, it downloads all pokémon images in a defined range which is 1-151 by default (I'm old these are the ones I know) and converts the images to escape sequences. These are saved in /usr/share/pokeshell.

Now when you open a new shell you could display one of them randomly by putting this code in your ~/.bashrc:

cat /usr/share/pokeshell/\$((\$RANDOM % 151 + 1)).pokemon

Or if you use fish like me put this in your ~/.config/fish/functions/fish_prompt.fish:

function fish_greeting
    set r (random)
    cat /usr/share/pokeshell/(math \"\$r % 151 + 1\").pokemon
end

The images are downloaded using the Pokéapi. For the conversation I use Imagemagick and a tool called img2xterm.

You can find a package for all of this in the AUR.