Waiting for any keypress to reset LED text

That works great! Thank you both for the excellent (and speedy!) help!

For anyone who is interested, here’s what I ended up with.

“bell” macro:

if ($bellWaiting) {
    exit
}
setVar bellWaiting true
setLedTxt 0 "BEL"
ifNotInterrupted goTo $currentAddress
setLedTxt 1 "BEL"
setVar bellWaiting false

And I have this bell function defined in my shell. Depending on the occasion, I might call it myself (e.g. commandThatMightFail || bell, longRunningCommand; bell), or my shell might, according to some extra configuration I have set up that can optionally call bell after any function that takes a long time to run.

# bell.fish
function bell
	# uses the terminal's built-in functionality to "ring the bell."
	# my terminal (Kitty) makes an audible tone
	# and shows a visual indicator
	tput bel
	# "bell" is the name of the UHK macro to call
	type -q uhkcmd && uhkcmd "exec bell" 2> /dev/null
end

Thanks to this UHK macro, I get not only visual and auditory feedback from my terminal, but also visual feedback from my keyboard! That has the advantage of working in the TTY as well.

2 Likes