From de93cfdba44004bc37e081ae03dba4f153c07845 Mon Sep 17 00:00:00 2001 From: Xavier Logerais Date: Thu, 24 Jan 2019 16:52:48 +0000 Subject: [PATCH] Replaced powerline with powerline-go --- rc.d/prompt | 17 +++++++++++++---- rc.d/termtitle | 11 ----------- rc.d/zz-powerline | 26 -------------------------- 3 files changed, 13 insertions(+), 41 deletions(-) mode change 100644 => 100755 rc.d/prompt delete mode 100644 rc.d/termtitle delete mode 100644 rc.d/zz-powerline diff --git a/rc.d/prompt b/rc.d/prompt old mode 100644 new mode 100755 index 488a357..a882c4c --- a/rc.d/prompt +++ b/rc.d/prompt @@ -1,10 +1,20 @@ #!/bin/bash # Customize the prompt -if [ "$UID" -eq 0 ]; then - export PS1='\[\e[01;31m\]\u@\h\[\e[01;34m\] \w \$\[\e[0m\] ' + +if (which powerline-go &> /dev/null); then + function _update_ps1() { + PS1="$(powerline-go -error $?)" + } + if [ "$TERM" != "linux" ] ; then + export PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" + fi else - export PS1='\[\e[01;32m\]\u@\h\[\e[01;34m\] \w \$\[\e[0m\] ' + if [ "$UID" -eq 0 ]; then + export PS1='\[\e[01;31m\]\u@\h\[\e[01;34m\] \w \$\[\e[0m\] ' + else + export PS1='\[\e[01;32m\]\u@\h\[\e[01;34m\] \w \$\[\e[0m\] ' + fi fi # Limit the path to 3 levels @@ -21,4 +31,3 @@ PROMPT_DIRTRIM=3 # fi #} #export PS1='\[\e[01;32m\]\u@\h\[\e[01;34m\] \w \$\[\e[0m\] '"\$(smiley) " - diff --git a/rc.d/termtitle b/rc.d/termtitle deleted file mode 100644 index d6c6581..0000000 --- a/rc.d/termtitle +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# Change the window title of X terminals -case $TERM in - xterm*|rxvt*|urxvt*|Eterm) - PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"' - ;; - screen*) - PROMPT_COMMAND='echo -ne "\033k${USER}@${HOSTNAME%%.*}\033\\"' - ;; -esac diff --git a/rc.d/zz-powerline b/rc.d/zz-powerline deleted file mode 100644 index bb906e5..0000000 --- a/rc.d/zz-powerline +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Powerline -POWERLINE_FILE=/usr/share/powerline/bash/powerline.sh - -if [ -f "${POWERLINE_FILE}" -a -z "$SSH_CONNECTION" ] -then - - #export URXVT_FONT_NAME="Terminus for Powerline" - export URXVT_FONT_NAME="DejaVu Sans Mono for Powerline" - export URXVT_FONT_SIZE="8" - - xrdb -merge <<"EOF" -XTerm*utf8: 1 -XTerm*faceName: ${URXVT_FONT_NAME} -XTerm*faceSize: ${URXVT_FONT_SIZE} -UXTerm*utf8: 1 -UXTerm*faceName: ${URXVT_FONT_NAME} -UXTerm*faceSize: ${URXVT_FONT_SIZE} -URxvt*font: xft:${URXVT_FONT_NAME}-${URXVT_FONT_SIZE} -EOF - test -f ~/.Xresources.powerline && xrdb -merge ~/.Xresources.powerline - - urxvt_set_font "${URXVT_FONT_NAME}-${URXVT_FONT_SIZE}" - source ${POWERLINE_FILE} -fi