I’d argue there’s a simpler approach, as suggested by both Robin and me
There may be a good reason why the OP’s workflow doesn’t support this, of course but, if there is, we’ve not been told it. In fact the OP doesn’t seem to have responded for some time.
I just received my PCsensor PS/2 Triple Pedals Foot Switch. The 3 button USB foot pedal form PCSensor.com was very affordable and a cost effective solution.
After a little searching I found Linux software on Github by rgerganov footswitch works great after some manual changes to the source code to correctly identify the vendorId and productId for my footswitch using lsusb.
I finally managed to program the buttons in Linux without the Windows program provided by the vendor and programmed the buttons as follows