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 0000000..99d7d62 Binary files /dev/null and b/plshell/.config/powerline-shell/__pycache__/kapp.cpython-37.pyc differ 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