I know it’s quite some time that this script is working flawlessly, or almost, but I just realize something and may impact others so I’ll leave my piece of experience here.
Some time ago my Rpi4 with the latest OSMC version at the time, can’t remember the exact date neither the version, my TV remote suddenly stop working. Every time that I rebuild my system, it works so I decided it was time to re do everything from scratch and clean up my library also.
So it was working since them, I believe around 6 months, and yesterday I decided to install VNC and them the remote stop working.
Today I remove VNC, using the script from this page, (BTW Thanks Sandbird), and the remote started to work again.
I do not know way or how one thing related to the other, but if you are experiencing problems with your remote AND have installed VNC, try to remove it. For me worked.