I’m looking for a way to get key presses for a program I’m working on. I don’t want the user to have to type something then press enter with something like the scanln function. I want it to listen to key presses in the background then react when it sees that a certain key has been pressed.
I found this library https://github.com/eiannone/keyboard, but the listening functions it offers are blocking, and there isn’t a function for detecting when a key isn’t pressed.
I need a non-blocking way of detecting key presses and key releases. Is there a library for doing this? Or a (relatively) simple way of doing it manually?