Any advice on products? I see there are many. Does not look like any support multiple programs so I can't reuse keys for different programs.
If you want to build your own, I can warmly recommend
Teensy LC for this. It has a native USB, so it will
be a standard USB keyboard; no drivers needed anywhere, and it will work as-is with every operating system (that supports USB keyboards). Moreover, the Teensyduino add-on to Arduino has
USB keyboard support built in, so all you need to do is write the logic for converting keypresses to HID events yourself. (That is, it has
keyboard.print() you can use to emit the keystroke macros.)
As to the board, I do recommend the diode-per-key matrix form. I know many people dislike it, but it gives the extra robustness that I crave. I've even designed a
Teensy LC button matrix with up to 32 buttons and 9 pots, where each button or pot is wired (with actual wires, I mean) to the button itself, not sitting on the board. The schematic itself is trivial,
Note that the resistors are there for "safety" (ensuring programming bugs won't burn the microcontroller I/O pins by effectively shorting VCC and GND).
The reason for designing this is that such "keypads" are useful for e.g. game cabinets running Linux and some emulator like MAME. The hard part is finding buttons and their positioning that have the feel you like. I happen to like the feel of the standard 12×12mm tactile buttons with round or square hats (see my
Pro Micro clone Gamepad), but their placement is nontrivial.
So, what I'd suggest, is making something like the above board, and then either 3D print or manipulate dead tree carcasses to make different "keyboards", for just holding the tactile buttons in place, with enough room to run their wires to the separate board. That way you can change the positioning of those buttons without having to make a new board for each one, by just 3D printing or chiseling a new button holder. (I can imagine, for example, that the cheapie 6mm×6mm tactile switches in two or three dense arcs would work better here, just left/right of your keyboard, the other side of your mouse/trackball. But I don't know for sure, and experimentation is needed to find out.)
I can imagine also adding a couple of rotary encoders (EC11 or similar) or mouse wheels for horizontal/vertical scrolling or panning.
Since Teensy LC uses 3.3V signaling, it can also directly interface to the small OLED displays (I recommend the
128x32 or
128x64 I2C ones using SSD1306 controllers (also from eBay/Banggood/etc.), so if you add a couple of "switch macro set" buttons, you could have multiple sets of macros the keys can emit, with the small OLED showing the macro set name. You can even add a "explain" button, so pressing it and any other button shows what macro that other button emits. (The Pro Micro clones typically run at 5V, but the small OLED displays really prefer 3.3V signaling. Teensy LC can only provide about 100mA at 3.3V for external devices, but these OLED displays consume under 35mA even when fully lit.)
If you don't like Teensies, there are lots of other microcontrollers you can use instead; just pick one that has native USB. My reason for suggesting Teensy LC for this is because I know it works, is cheap, and is easy to program (due to Teensyduino support, especially
keyboard.print()). I do not claim it is the best for this; just that even an uncle bumblefuck like me can easily make it work.
If you don't want to build anything yourself, and instead want to buy something off the shelf, I wonder if an external touchpad – projected capacitive kind, like the Apple ones – might work. The idea is, you basically place a sheet of paper, or a transparency (with print in reverse on the underside), on top of the pad, to remind you of the button locations.
You'd need to write a "driver" yourself for mapping the touchpad locations to buttons triggering macros, but at least in Linux that is trivial. I recently showed DiTBho
a skeleton of such an uinput daemon with virtual button support, but for a matrix of touchpad buttons, it would be even simpler. A companion program, say a Python3 Qt UI or C GTK+3 UI could provide an interface for changing the button grid and macros at run time, saving configurations as "sets" you could switch at any time.
I can say that if anyone provided one (an external USB HID touchpad) for me, it'd be just a couple of days work of writing those programs and packaging them for e.g. Debian derivatives.
I don't have Windows, though, and don't write Windows drivers or programs, though; but I do believe the same is possible there, too.