A configurable bash prompt inspired by the Tokyo Night Theme for Neovim.
Requires a Nerd Font
Highlights the current directory and changes the color of User@Host depending on whether you're in HOME/, root/, or /mnt.
There are currently three themes to choose from.
Themes can be changed via the theme Config setting.
There are optional backgrounds that can be enable via the background Config setting.
There are three variatons to choose from:
Abbreviates paths longer than 50 characters.
If the current directory is a repository it will display the current branch name.
An icon bar that displays changes in the current repository.
Displays (in order):
- Number of untracked files
- Number of files with unstaged changes
- Number of staged files
- Number of local commits
- Number of remote commits.
Note
The feature to auto-fetch commits is disabled by default.
Can be enabled via the fetch Config setting.
And modified with the fetchtimer Config setting.
The easiest way would be to have make and gcc/clang installed on your system. For instructions on how to install without make click here.
In the root of the tokyobash repository, there are three commands to use:
makeWill build the tokyobash binary and place it in/binin the root of the tokyobash repository.
make installWill build tokyobash, create and then move the config file to$XDG_CONFIG_HOME/tokyobashif one is not already present.- The config directory defaults to
$XDG_CONFIG_HOME. If for any reason$XDG_CONFIG_HOMEcan't be resolved, the config directory will default to$HOME/.config.
- The config directory defaults to
make install prefix=custom/pathWill build tokyobash, create and move config file, then move tokyobash toprefix/bin.
Add this to your .bashrc (usually located at $HOME/.bashrc):
export PROMPT_COMMAND='PS1="$(path/to/tokyobash)"'Replace path/to/tokyobash above with the acutal path to the compiled tokyobash binary.
If tokyobash was placed somewhere that's in your $PATH, then your PROMPT_COMMAND can look like this.
export PROMPT_COMMAND='PS1="$(tokyobash)"'Now save and restart your terminal!
Config file uses standard key = value pairs.
# or // can be used for comments.
Spaces, single, and double quotes are ignored.
1 = enabled 0 = disabled - except for background, time, and fetchtimer, which have multiple options explained below.
theme = tokyonight
#theme = catppuccin
#theme = kanagawa
background = 0 # 0 = Off, 1 = pointed, 2 = rounded, 3 = slanted.
time = 1 # 0 = Off, 1 = 24-hour clock, 2 = 12-hour clock.
abvpath = 1 # Abberviate path on/off
branchname = 1 # Turn the display of branch name on/off.
statusbar = 1 # Turn statusbar on/off.
fetch = 0 # Turn fetching of commits on/off.
fetchtimer = 1d # See below.
icon = ξ― # Change icon or set to 0 to remove.
fetchtimer will accept #d, #h, or #m. d = days h = hours and m = minutes.
- If
fetchtimer = 25mrepository will update after 25 minutes, when the prompt reloads. - If
fetchtimer = 2hrepository will update after 2 hours, when the prompt reloads. - If
fetchtimer = 3drepository will update after 3 days, when the prompt reloads. fetchtimer = 1h30mis not vaild. Only oneDay,Hour, orMinutemodifier is allowed.
All you really need is a C compiler to build Tokyobash.
So, if you dont have make you can use these commands in the top level of the tokyobash repository.
For gcc:
gcc -c src/tokyobash.c
gcc -c src/lib/tokyobashlib.c
gcc -c src/lib/gitlib.c
gcc -c src/lib/shouldFetchlib.c
gcc -c src/lib/printlib.c
gcc -O3 tokyobash.o tokyobashlib.o gitlib.o shouldFetchlib.o printlib.o -o tokyobash
rm tokyobash.o tokyobashlib.o gitlib.o shouldFetchlib.o printlib.oFor clang:
clang -c src/tokyobash.c
clang -c src/lib/tokyobashlib.c
clang -c src/lib/gitlib.c
clang -c src/lib/shouldFetchlib.c
clang -c src/lib/printlib.c
clang -O3 tokyobash.o tokyobashlib.o gitlib.o shouldFetchlib.o printlib.o -o tokyobash
rm tokyobash.o tokyobashlib.o gitlib.o shouldFetchlib.o printlib.oYou will need to manually create the directory tokyobash in ~/.config or wherever you may have $XDG_CONFIG_HOME set.
Try these commands in your terminal. They will create the tokyobash/config directory and file in your XDG_CONFIG_HOME directory loaded with the defaults.
mkdir -p $XDG_CONFIG_HOME/tokyobash/
{
printf 'theme = tokyonight\n'
printf '#theme = catppuccin\n'
printf '#theme = kanagawa\n\n'
printf 'background = 0\n'
printf 'time = 1\n'
printf 'abvpath = 1\n'
printf 'branchname = 1\n'
printf 'statusbar = 1\n'
printf 'fetch = 0\n'
printf 'fetchtimer = 1d\n'
printf 'icon = ξ―\n'
} >$XDG_CONFIG_HOME/tokyobash/configI'm not sure if this will run on all linux distros. I believe it should work on most if not all.
I'm also new to programming so any feedback is welcomed. So if I'm doing somthing stupid (I'm sure I am somewhere) please let me know.
All screenshots were taken with: ghostty terminal with tokyonight theme.











