inz.fi

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 83232a1d30e6f47943e4c5526519ee3fe60c73db
parent 4598a9b6567d19d2f054d08ef6056791143e5457
Author: Santtu Lakkala <inz@inz.fi>
Date:   Sat, 25 Jul 2020 12:24:20 +0000

Prompt silliness

Diffstat:
Aposts/prompt-silliness.md | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/posts/prompt-silliness.md b/posts/prompt-silliness.md @@ -0,0 +1,11 @@ +# Prompt silliness + +While having fun with terminal colors, the old-school 16 colors, the extended 256 colors, and the more extended 24-bit colors, I noticed that the 256 color palette is modifiable with OSC codes (seems to work with st, xterm, rxvt, gnome-terminal; and NOT with at least putty and qterminal). + +Palette changing does not sound very exciting when you also have 24-bit colours, but it does have its perks. Namely: changing the palette also affects all blocks already appearing on screen. Hence by side-loading palette control codes, you can change what is shown on the screen without actually touching the contents. + +And that led to the incubation of a little utility that puts a clock on your terminal that updates even when the shell is idle, which then extended a bit with a 4-bar cpu meter. The [resulting utility](https://inz.fi/git/inz/prompt) outputs a string with the appropriate placeholders (to be put into PS1: PS1="$(prompt)"). The output is escaped in bash style. The utility spawns a background process and periodically feeds palette changes to the tty. + +Another utility abusing the same mechanism is [nyancat](https://inz.fi/git/inz/nyancat). (Probably should rename, as nyancat is already a thing; but it is cat, and it does nyan, so whatchamacallit...). When fed the -g or -n flags, uses palette tricks in the same manner to make your eyes bleed with rainbows everywhere. + +Also while pushing the latter one to git, wrote a small ANSI code "syntax hilighter" for gitea, the [resulting snippet](https://inz.fi/p/ansi.js) works well enough for my purposes. +\ No newline at end of file