When it's an input event in Linux, and you want direct control over what it does, it ultimately ends in writing a daemon with libevdev to get the device event. At least, that is what happened to me last time.
Maybe worth checking if one is not supported to use libinput instead of processing kernel events directly though. [2]
If someone is interested in the input topic, Peter Hutterer's blog is very nice to read. I also enjoyed his talk about libinput's bus factor [3].
[1] https://who-t.blogspot.com/2013/09/libevdev-handling-input-e...
[2] https://who-t.blogspot.com/2018/07/why-its-not-good-idea-to-...
[3] https://who-t.blogspot.com/2019/10/libinputs-bus-factor-is-1...