From b8c6922e05b4535996b7ddc80031e2dbcfa2f5ec Mon Sep 17 00:00:00 2001 From: Shaun Reed Date: Sat, 21 Sep 2019 01:36:29 -0400 Subject: [PATCH] Add powerline shell prompt --- bash/.bashrc | 16 ++++-- .../__pycache__/kapp.cpython-37.pyc | Bin 0 -> 1047 bytes plshell/.config/powerline-shell/config.json | 11 ++++ plshell/.config/powerline-shell/kapp.py | 54 ++++++++++++++++++ .../.config/powerline-shell/powerline-shell | 1 + 5 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 plshell/.config/powerline-shell/__pycache__/kapp.cpython-37.pyc create mode 100644 plshell/.config/powerline-shell/config.json create mode 100644 plshell/.config/powerline-shell/kapp.py create mode 160000 plshell/.config/powerline-shell/powerline-shell diff --git a/bash/.bashrc b/bash/.bashrc index 98919f2..e11426b 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -57,11 +57,19 @@ if [ -n "$force_color_prompt" ]; then fi fi -if [ "$color_prompt" = yes ]; then - PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\][\u@\h\[\033[00m\] \W\[\033[01;32m\]]\$\[\033[00m\]' -else - PS1='${debian_chroot:+($debian_chroot)}[\u@\h \W]\$ ' +function _update_ps1() { + PS1=$(powerline-shell $?) +} + +if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then + PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" fi + +" if [ "$color_prompt" = yes ]; then +" PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\][\u@\h\[\033[00m\] \W\[\033[01;32m\]]\$\[\033[00m\]' +" else +" PS1='${debian_chroot:+($debian_chroot)}[\u@\h \W]\$ ' +" fi unset color_prompt force_color_prompt # If this is an xterm set the title to user@host:dir diff --git a/plshell/.config/powerline-shell/__pycache__/kapp.cpython-37.pyc b/plshell/.config/powerline-shell/__pycache__/kapp.cpython-37.pyc new file mode 100644 index 0000000000000000000000000000000000000000..99d7d620c1394445610205cd21a564294ab460d8 GIT binary patch literal 1047 zcmZWoOK;jh5ME;l1WZC6eYdIG8&U)5p|>cC!RApB+p-B!R;pHr-2_yFsT~xh*S2c^ zO8*kqUdmtSsWa<@5_PSa{l58TXLjv%tys(x7>D1#efXUw^I@7LY~C%3L$WMSm7t)x#i+1{k~>3V>s<_y;&asKN;> zR;bETG|g3-;c2=CILk9M$JgjO@I2rGXd28#o~0XrH^EAfx5aaG8}JU;F62IdoQDv9 z#MkL#n4gGk`c&-DXApl5`~}a`J;-|rrt<=Q#WmP?ah{P|{d`dC$D@IMH56l^Uk^uv zp&m|x8+{gwSRdeNVtq8x5BA@_)1&_6Qbc&5#U{EOx)iv^LIzdj1#}zevf%9U>v@i` zNq;ODo97uDhkOj$?=mN6a<7^8(#-|}qZ#A1!+3aK?|X{mUQ(`67Tv>d;? z%v};tc3Tcq@Lj9kHag5~`)9Rw!0O+A!Lk z74?>ay5aY1R&N=0)ADigJ&t-0ws8uFx9pzOS2^m&na^C$X+VA4)IE-`sM}7yK>}*c zpCl^52bJ#6o9Zwei|WVzbSk21We`p-MwiuTcrBt}G!gspPy~ULE7O|@?}Y{yAA!p$ z>EubljP^fURqpWZENj_imF_K@G1;slZ*W}U$$uE(wUo*KcAcOt5azkV literal 0 HcmV?d00001 diff --git a/plshell/.config/powerline-shell/config.json b/plshell/.config/powerline-shell/config.json new file mode 100644 index 0000000..ef4cae6 --- /dev/null +++ b/plshell/.config/powerline-shell/config.json @@ -0,0 +1,11 @@ +{ + "segments": [ + "virtual_env", + "ssh", + "cwd", + "hg", + "jobs", + "root" + ], + "theme": "~/.config/powerline-shell/kapp.py" +} diff --git a/plshell/.config/powerline-shell/kapp.py b/plshell/.config/powerline-shell/kapp.py new file mode 100644 index 0000000..9a011d2 --- /dev/null +++ b/plshell/.config/powerline-shell/kapp.py @@ -0,0 +1,54 @@ +from powerline_shell.themes.default import DefaultColor + +# 0 — black 8 — gray +# 1 — maroon 9 — red +# 2 — green 10 — lime +# 3 — olive 11 — yellow +# 4 — navy 12 — blue +# 5 — purple 13 — fuchsia +# 6 — teal 14 — aqua +# 7 — silver 15 — white + +class Color(DefaultColor): + """Basic theme which only uses colors in 0-15 range""" + USERNAME_FG = 0 # black + USERNAME_BG = 15 # white + USERNAME_ROOT_BG = 8 # gray + + HOSTNAME_FG = 0 # black + HOSTNAME_BG = 2 # green + + HOME_SPECIAL_DISPLAY = False + PATH_BG = 8 # gray + PATH_FG = 2 # silver + CWD_FG = 15 # white + SEPARATOR_FG = 2 + + READONLY_BG = 1 # maroon + READONLY_FG = 15 # white + + REPO_CLEAN_BG = 15 # green + REPO_CLEAN_FG = 0 # black + REPO_DIRTY_BG = 3 # olive + REPO_DIRTY_FG = 15 # white + + JOBS_FG = 15 # white + JOBS_BG = 8 # gray + + CMD_PASSED_BG = 2 # green + CMD_PASSED_FG = 0 # black + CMD_FAILED_BG = 11 # yellow + CMD_FAILED_FG = 0 # black + + SVN_CHANGES_BG = REPO_DIRTY_BG + SVN_CHANGES_FG = REPO_DIRTY_FG + + VIRTUAL_ENV_BG = 2 # green + VIRTUAL_ENV_FG = 0 # black + + AWS_PROFILE_FG = 14 # aqua + AWS_PROFILE_BG = 8 # gray + + TIME_FG = 8 # gray + TIME_BG = 7 # silver + diff --git a/plshell/.config/powerline-shell/powerline-shell b/plshell/.config/powerline-shell/powerline-shell new file mode 160000 index 0000000..a9b8c9b --- /dev/null +++ b/plshell/.config/powerline-shell/powerline-shell @@ -0,0 +1 @@ +Subproject commit a9b8c9bb39dbfb7ec3c639e497b5a76fa6dcb8cc