diff --git a/.zshrc b/.zshrc index 4ff9064..19ddc57 100644 --- a/.zshrc +++ b/.zshrc @@ -146,7 +146,15 @@ vcs_info_wrapper() { echo "%{$fg_bold[grey]%}${vcs_info_msg_0_}%{$reset_color%}$del" fi } -RPROMPT=$'$(vcs_info_wrapper)${PTIME}' +terraform_wrapper() { + if [[ -d .terraform ]]; then + local tf_workspace=$(terraform workspace show) + if [ -n "$tf_workspace" ]; then + echo "%{$fg_bold[grey]%}[%{$fg_no_bold[blue]%}${tf_workspace}%{$fg_bold[grey]%}]%{$reset_color%}$del" + fi + fi +} +RPROMPT=$'$(terraform_wrapper)$(vcs_info_wrapper)${PTIME}' if [ `uname -s` = "SunOS" ] ; then export LANG="C" diff --git a/local/bin/battery.sh b/local/bin/battery.sh index 7b73732..a231cd9 100755 --- a/local/bin/battery.sh +++ b/local/bin/battery.sh @@ -13,7 +13,13 @@ GFG='#379' # color of the gauge GH=10 # height of the gauge GBG='#333' # color of gauge background #X=1807 # x position -X="$(expr "$(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+)x[0-9]+.*$/\1/')" - $W - 2)" # x position +#X="$(expr "$(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+)x[0-9]+.*$/\1/')" - $W - 2)" # x position +PRIMARY="$(xrandr -q | grep primary)" # x position +if [ -z "${PRIMARY}" ]; then + X="$(expr "$(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+)x[0-9]+.*$/\1/')" - $W - 2)" # x position +else + X="$(expr "$(xrandr -q | grep primary | sed -r 's/^.+?[^0-9]+([0-9]+)x[0-9]+\+.*$/\1/')" - $W - 2)" # x position +fi Y=2 # y position FN='xft:Liberation Mono:size=8' # font @@ -37,9 +43,9 @@ while true; do STATE=`cat $STATEFILE`; # draw the bar and pipe everything into dzen - if [ $RPERC -gt $LOWBAT ]; then GFGC=$GFG; fi - if [ $RPERC -le $LOWBAT ]; then GFGC=$LOWCOL; fi - if [ $STATE = "Charging" ]; then GFGC=$CHRGCOL; fi + if [ "${RPERC}" -gt $LOWBAT ]; then GFGC=$GFG; fi + if [ "${RPERC}" -le $LOWBAT ]; then GFGC=$LOWCOL; fi + if [ "${STATE}" = "Charging" ]; then GFGC=$CHRGCOL; fi case $RPERC in $LOWBAT)