I want to write a script that runs a specific PowerShell command when one of my mouse's additional buttons is clicked.
Example: Clicking the third mouse's button will run echo "…"
PowerShell command.
But I'm not sure what's the best way to listen to this kind of the OS events. Please advice.
I found this resourcet to be super useful https://learn.microsoft.com/en-us/archive/blogs/toub/low-level-keyboard-hook-in-c
You just need to change WH_KEYBOARD_LL
value to be 14 to start listening to mouse events.