Crazy idea I've always wanted to try: somehow hack a USB foot-pedal to act as a layer key.
(Hard, because usually the layers are implemented inside the keyboard's firmware, rather than being processed by the OS. Maybe the foot-pedal would need to plug into the keyboard.)
Doesn't work for keys that don't send keysyms by default but instead act as e.g. media keys if you're not holding a modifier. (Media keys are their own USB HID usage page; the OS keyboard driver doesn't see them.)