The Kobowriter project (
https://github.com/olup/kobowriter) seems to provide a way to do this. I haven't tried it, but have been intrigued by the project for a while. (Apparently it only supports the French azerty layout at the moment, though if you only want page up and down buttons that might not matter.) The documentation seems to assume a micro-USB Kobo, but surely it would also work a USB-C model?