battery warning fix; zsh beam simplified

This commit is contained in:
Luke Smith 2020-12-18 11:56:46 -05:00
parent 29c8156e66
commit 741e9298bd
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252
2 changed files with 7 additions and 12 deletions

View file

@ -36,16 +36,11 @@ bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -v '^?' backward-delete-char bindkey -v '^?' backward-delete-char
# Change cursor shape for different vi modes. # Change cursor shape for different vi modes.
function zle-keymap-select { function zle-keymap-select () {
if [[ ${KEYMAP} == vicmd ]] || case $KEYMAP in
[[ $1 = 'block' ]]; then vicmd) echo -ne '\e[1 q';; # block
echo -ne '\e[1 q' viins|main) echo -ne '\e[5 q';; # beam
elif [[ ${KEYMAP} == main ]] || esac
[[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then
echo -ne '\e[5 q'
fi
} }
zle -N zle-keymap-select zle -N zle-keymap-select
zle-line-init() { zle-line-init() {

View file

@ -33,7 +33,7 @@ do
esac esac
capacity=$(cat "$battery/capacity") capacity=$(cat "$battery/capacity")
# Will make a warn variable if discharging and low # Will make a warn variable if discharging and low
[ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && local warn="❗" [ "$status" = "🔋" ] && [ "$capacity" -le 25 ] && warn="❗"
# Prints the info # Prints the info
printf "%s%s%d%%\n" "$status" "$warn" "$capacity" printf "%s%s%d%%\n" "$status" "$warn" "$capacity"; unset warn
done && return 0 done && return 0