Update battery.sh and tf workspace in prompt
This commit is contained in:
parent
830a9156d7
commit
8538bbea9c
2 changed files with 19 additions and 5 deletions
10
.zshrc
10
.zshrc
|
|
@ -146,7 +146,15 @@ vcs_info_wrapper() {
|
||||||
echo "%{$fg_bold[grey]%}${vcs_info_msg_0_}%{$reset_color%}$del"
|
echo "%{$fg_bold[grey]%}${vcs_info_msg_0_}%{$reset_color%}$del"
|
||||||
fi
|
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
|
if [ `uname -s` = "SunOS" ] ; then
|
||||||
export LANG="C"
|
export LANG="C"
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,13 @@ GFG='#379' # color of the gauge
|
||||||
GH=10 # height of the gauge
|
GH=10 # height of the gauge
|
||||||
GBG='#333' # color of gauge background
|
GBG='#333' # color of gauge background
|
||||||
#X=1807 # x position
|
#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
|
Y=2 # y position
|
||||||
FN='xft:Liberation Mono:size=8' # font
|
FN='xft:Liberation Mono:size=8' # font
|
||||||
|
|
||||||
|
|
@ -37,9 +43,9 @@ while true; do
|
||||||
STATE=`cat $STATEFILE`;
|
STATE=`cat $STATEFILE`;
|
||||||
|
|
||||||
# draw the bar and pipe everything into dzen
|
# draw the bar and pipe everything into dzen
|
||||||
if [ $RPERC -gt $LOWBAT ]; then GFGC=$GFG; fi
|
if [ "${RPERC}" -gt $LOWBAT ]; then GFGC=$GFG; fi
|
||||||
if [ $RPERC -le $LOWBAT ]; then GFGC=$LOWCOL; fi
|
if [ "${RPERC}" -le $LOWBAT ]; then GFGC=$LOWCOL; fi
|
||||||
if [ $STATE = "Charging" ]; then GFGC=$CHRGCOL; fi
|
if [ "${STATE}" = "Charging" ]; then GFGC=$CHRGCOL; fi
|
||||||
|
|
||||||
case $RPERC in
|
case $RPERC in
|
||||||
$LOWBAT)
|
$LOWBAT)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue