Close

Shortcut Overlays!

A project log for PolyKybd (Displays In Your Keycaps)

Freedom at your fingertip.

thpollthpoll 04/02/2024 at 21:300 Comments

Alright, so this was a bit harder than expected and I was suffering quite a bit!

Nevertheless, I'm glad to show you the first program shortcuts that have been sent from the computer to the keyboard:

Some of you might have noticed right away: These are GIMP shortcuts and as I found out... They are quite useful! I looked them up on a cheat sheet first. Not anymore!! 😁

Its satisfying to see the last of the 3 use cases (next to different languages and arbitrary layouts) I originally planned, come to life.

Of course, there is still a lot of work to be done, but as usual step by step.

I organize the shortcuts in images with space for 90 (10x9) keys with each having the full 72x40px resolution. By intention, I decided to pick the full resolution and not just some space for the overlay as this host-driven fully graphical approach feels more powerful than the text-based rendering from the PolyKybd itself. With that, I could do a lot of customizations (different fonts, text sizes, etc...) on the fly without pre-programming it into the firmware.

Here is my current example:

It's not complete, but it works for my current test scenario.

There are 3 more images needed as the shortcuts usually differ if you press CTRL, ALT or SHIFT. Maybe I put just all together into an image using the RGB channels for the version when pressing the modifiers and the alpha channel for the shortcuts without modifiers.

So why was it so difficult? Good question. I chose Phyton for the host program, so it can be easily changed by everyone and can potentially run on every platform without the need of compilers etc. While I did some work with Python in the past, I never had to deal with image manipulation before.

This is, where my problem started. Without getting into too much detail: It was not easy to find images libraries that work on Windows, Linux and Mac, that have no namespace collision issue a la PIL and Pillow and run together with Qt (openCV doesn't). I settled on the obvious choice of NumPy and used imageio for loading the image data instead of PIL. Maybe all the Python wizards are laughing now and could have done it during lunch break, but believe me when I tell you it took me multiple days (sure I'm not working on this full-time). Besides that setup issue, it also took me some time to prepare the data (slice the image to the individual overlays, encode them as monochrome bitmaps, transfer only entries with actual content...) so it can be understood by the keyboard and its HID protocol.

In case you want to take a look at it: https://github.com/thpoll83/PolyKybdHost The most recent firmware will gladly accept the overlay, but not transfer it to the other side, that is still something I have to do.

Be warned that I just tested it on Linux and it is not intended for a real user.

And Here Is Some Other News!

I will talk about the PolyKybd at Hackaday Europe 2024 on the 13th of April, 3pm!! The lineup is not yet announced, but I will add a link as soon as possible. Let me know if you will be there as well!

Best, Thomas

Discussions