Update battery.sh and tf workspace in prompt

This commit is contained in:
Hunter Haugen 2023-07-05 08:57:48 -07:00
parent 830a9156d7
commit 8538bbea9c
Signed by: hunner
GPG key ID: EF99694AA599DDAD
2 changed files with 19 additions and 5 deletions

10
.zshrc
View file

@ -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"

View file

@ -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
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)