Part of my ZSH prompt is a caps lock indicator.
function Capslock(){
x=$(xset -q | grep Caps) 2> /dev/null || exit 0
x=${x:22:1}
if [[ $x == "n" ]]; then
echo ""
fi
}
POWERLEVEL9K_CUSTOM_CAPS="Capslock"
POWERLEVEL9K_CUSTOM_CAPS_BACKGROUND="red"
POWERLEVEL9K_CUSTOM_CAPS_FOREGROUND="white"
You will see I am using oh-my-zsh and the POWERLEVEL9k theme although I don't know if this is necessary for the question.
I would like to trigger the re-drawing of the prompt when the capslock button is pushed. Is this possible?
EDIT:
Thanks both of you for your answers, they both work. I am just looking into the correct way to accept two answers.