From 8fc77963e62564480b890c293eff5990b7119f54 Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Tue, 11 Oct 2016 23:18:39 +0200 Subject: [PATCH] Jobs in ps1, renamed bashrc to bash/rc --- bash/bash.d/ps1 | 22 ++++++++++++++++++---- bash/profile | 10 ++++++++++ bash/{bashrc => rc} | 0 install.conf.yaml | 3 ++- install => install.sh | 0 profiles/main.sh | 4 ++-- 6 files changed, 32 insertions(+), 7 deletions(-) rename bash/{bashrc => rc} (100%) rename install => install.sh (100%) diff --git a/bash/bash.d/ps1 b/bash/bash.d/ps1 index e027d20..392f610 100644 --- a/bash/bash.d/ps1 +++ b/bash/bash.d/ps1 @@ -51,11 +51,17 @@ function __prompt_command() { if [ -n $RETVAL ]; then PS1+="$(retval ${RETVAL})" fi + +### Add amount of jobs ### + if true; then + PS1+="$(jobscount)" + fi + ### Add Git Status ### if [[ $(command -v git) ]]; then PS1+="$(git_status) " fi - + #user@hostname if color ; then @@ -73,6 +79,7 @@ function __prompt_command() { 'fatserf') PS1+="${Pur}\H${RCol}";; 'lilo'*) PS1+="${BWhi}\H${RCol}";; 'hg'*) PS1+="${BRed}\H${RCol}";; + 'gouda'|'bunnik'|'houten'|'zandberg'|'bussum') PS1+="${Gre}${On_Whi}HEF:${Blu}${On_Whi}\H${RCol}";; *) PS1+="${Blu}${On_Whi}\H${RCol}";; esac else @@ -118,7 +125,14 @@ function retval() { fi fi - echo "${PS1} " + echo "${PS1}" +} + +### count jobs +function jobscount() { + local stopped=$(jobs -sp | wc -l) + local running=$(jobs -rp | wc -l) + ((running+stopped)) && echo -n "${IYel}${running}${RCol}|${Yel}${stopped}${RCol}" } function git_status() { @@ -134,7 +148,7 @@ function git_status() { ## Check if more than 60 minutes since last if [ "${TIME}" -gt "3600" ]; then git fetch 2>/dev/null - PS1+=' +' + PS1+='+ ' ## Refresh var local GStat="$(git status --porcelain -b 2>/dev/null | tr '\n' ':')" fi @@ -162,7 +176,7 @@ function git_status() { fi ### End Branch ### }}} - PS1+=" ${GitCol}[$GBra]${RCol}" # Add result to prompt + PS1+="${GitCol}[$GBra]${RCol}" # Add result to prompt ### Find Commit Status ### {{{ ## Test Modified and Untracked for "0" diff --git a/bash/profile b/bash/profile index 0b41862..071474b 100644 --- a/bash/profile +++ b/bash/profile @@ -1,3 +1,13 @@ +# ~/.bash_profile [ -z "$DOTFILES" ] && source "$HOME/.profile" [ -r "$HOME/.bash_profile.local" ] && source "$HOME/.bash_profile.local" + +if shopt -q login_shell +then +# This is a bash login shell + LOGINHISTORY=~/.login.history + LOGINSTRING="$(date) ${USER}@${HOSTNAME}" + + echo $LOGINSTRING > $LOGINHISTORY +fi diff --git a/bash/bashrc b/bash/rc similarity index 100% rename from bash/bashrc rename to bash/rc diff --git a/install.conf.yaml b/install.conf.yaml index faed0e9..18298ce 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -6,7 +6,8 @@ - clean: ['~'] - link: - ~/.bashrc: bash/bashrc + ~/.bashrc: bash/rc + ~/.bash_profile: bash/profile ~/.gitconfig: git/gitconfig ~/.gitignore_global: git/gitignore_global ~/.ncmpcpp/config: ncmpcpp/config diff --git a/install b/install.sh similarity index 100% rename from install rename to install.sh diff --git a/profiles/main.sh b/profiles/main.sh index 10c8bb7..943ab1c 100644 --- a/profiles/main.sh +++ b/profiles/main.sh @@ -30,7 +30,7 @@ then fi # Source Bashrc if BASH -if [ "$BASH" ] && [ -f $DOTFILES/bash/bashrc ] +if [ "$BASH" ] && [ -f $DOTFILES/bash/rc ] then - source $DOTFILES/bash/bashrc + source $DOTFILES/bash/rc fi