Triangular background for bash PS1 prompt

BaRud picture BaRud · Sep 7, 2015 · Viewed 7.2k times · Source

I am trying to get a triangular background for bash PS1 prompt. as shown here

I have tried the existing library called powerline but it seems to be heavy for my ageing laptop. I have managed to get the background colour, but have no idea of getting the shape. Currently what I have is: my PS1.

Is there any straight-forward way of having those shape?

I am using:

$ echo $TERM
xterm-256color
$ echo $SHELL
/bin/bash
$ bash --version
GNU bash, version 4.3.42(1)-release (x86_64-redhat-linux-gnu)

Answer

brujoand picture brujoand · Sep 7, 2015

You need to have powerline patched fonts installed. Get them here

And you need to configure your terminal to use them. (this ofc depends on your terminal but probably something like settings -> appearance -> fonts)

I've done something similar if you want a startingpoint: sbp You can try it out by running . prompt.bash.

Basically all you need if the fonts are installed and enabled is this $'\uE0B0' somewhere in your PS1. It's the utf8 code for the fancy triangle. Assuming you're on a recent version of bash with some utf8 as locale, that should do it. Try echo -e $'\uE0B0' in your terminal to test it.