#!/bin/bash
# -------------------------------------------------------------------
# ~/.bashrc: Bash config file for non-login shells.
# vim: set filetype=sh : (vim modeline for syntax of this file)
# (c) Copyright 2008 _m (http://eccentrix.com/misc/mammon)
# -------------------------------------------------------------------

# Exit early if non-interactive shell
[ -z "$PS1" ] && return

# -------------------------------------------------------------------
# Global settings
[ -f /etc/bash_completion ] && . /etc/bash_completion

# -------------------------------------------------------------------
# User-specific settings
[ -f ~/.bash_colors.rc ] && . ~/.bash_colors.rc	# Color definitions
[ -f ~/.bash_fn.rc ] && . ~/.bash_fn.rc		# Functions
[ -f ~/.bash_app.rc ] && . ~/.bash_app.rc	# Application aliases
[ -f ~/.bash_alias.rc ] && . ~/.bash_alias.rc	# Standard aliases
[ -f ~/.bash_env.rc ] && . ~/.bash_env.rc	# Environment variables

# -------------------------------------------------------------------
# Set prompt

# Terminal emulator caption
case $TERM in
        ?term* | rxvt | screen )
                if [ $UID -eq 0 ]
                then
                        XTITLE="\[\033]0;\u@\h:$PWD\007\]"
                else
                        XTITLE="\[\033]0;$(uprompt)\007\]"
                fi
                ;;
        * )
                XTITLE="" ;;
esac

# Shell prompt (PS1)
# XTITLE sets the terminal emulator if appropriate
# The current time (hour:minute) is displayed in WHITE
# The % of battery life remaining is displayed in GREEN/YELLOW/RED
# The remaining prompt is user@host:/path where path is truncated
# The final character is '>'
PS1="$XTITLE\
[${WHITE}\$(date +%H:%M)${NC}|\
\[\$(battery_color)\]\$(battery_life)${NC}%] \
$(uprompt)\
>\
${NC} "

export PS1
