From 5ae5fd6876082d95979c6afb8eedee1668a8ad2b Mon Sep 17 00:00:00 2001 From: Proctor Date: Thu, 11 Jun 2015 15:03:12 -0500 Subject: [PATCH] misc updates --- .bash_profile | 9 ++++++++- bin/tmux_battery_charge_indicator.sh | 20 ++++++++++++++++++++ tmux.conf | 2 ++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100755 bin/tmux_battery_charge_indicator.sh diff --git a/.bash_profile b/.bash_profile index 7cff78a..b501e58 100644 --- a/.bash_profile +++ b/.bash_profile @@ -5,10 +5,11 @@ PATH=/usr/local/bin:~/bin:/usr/local/share/npm/bin:$PATH PATH=$PATH:$HOME set -o vi +export EDITOR='vim' export CLICOLOR=1 -if which brew 2>/dev/null && [-f $(brew --prefix)/etc/bash_completion ]; then +if which brew 2>/dev/null && [ -f $(brew --prefix)/etc/bash_completion ]; then . $(brew --prefix)/etc/bash_completion fi @@ -45,3 +46,9 @@ source ~/.bash/aliases if [ -f ~/.bash_local ]; then . ~/.bash_local fi + +### Added by the Heroku Toolbelt +export PATH="/usr/local/heroku/bin:$PATH" + +export NVM_DIR="/Users/sg0221754/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm diff --git a/bin/tmux_battery_charge_indicator.sh b/bin/tmux_battery_charge_indicator.sh new file mode 100755 index 0000000..596601b --- /dev/null +++ b/bin/tmux_battery_charge_indicator.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +HEART='♥' + +battery_info=`ioreg -rc AppleSmartBattery` +current_charge=$(echo $battery_info | grep -o '"CurrentCapacity" = [0-9]\+' | cut -d ' ' -f 3) +total_charge=$(echo $battery_info | grep -o '"MaxCapacity" = [0-9]\+' | cut -d ' ' -f 3) + +charged_slots=$(echo "(($current_charge/$total_charge)*10)+1" | bc -l | cut -d '.' -f 1) +if [[ $charged_slots -gt 10 ]]; then + charged_slots=10 +fi + +echo -n '#[fg=red]' +for i in `seq 1 $charged_slots`; do echo -n "$HEART"; done + +if [[ $charged_slots -lt 10 ]]; then + echo -n '#[fg=white]' + for i in `seq 1 $(echo "10-$charged_slots" | bc)`; do echo -n "$HEART"; done +fi diff --git a/tmux.conf b/tmux.conf index fcf96ca..808189a 100644 --- a/tmux.conf +++ b/tmux.conf @@ -35,5 +35,7 @@ set -g window-status-current-attr bright setw -g mode-keys vi +set -g status-right '#(~/dotfiles/bin/tmux_battery_charge_indicator.sh) #[bg=white,fg=colour240] %H:%M #[bg=colour240,fg=white] %Y-%m-%d ' + set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY" set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock