Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Triangular background for bash PS1 prompt

Tags:

bash

prompt

ps1

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)
like image 249
BaRud Avatar asked Sep 07 '15 17:09

BaRud


1 Answers

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.

like image 106
brujoand Avatar answered Nov 19 '22 13:11

brujoand