SpeedKeys: A Keypad Stream Deck Alternative

Because Keyboard Maestro can distinguish between the main keyboard and a 10-key numeric keypad, it's possible to use a keypad as a poor man's Steam Deck. USB keypads can be had for less than $10 and wireless ones for less than $15.

This implementation provides:

  • Custom keypad definitions for all but the Delete and Enter keys

  • A popup legend on the Period key

  • Switchable sets of defined keys

  • Auto switching of layouts based on application name

HARDWARE

We developed this macro set (which happens to use the same approach @tiffle proposed some years ago) using an old, forgotten wireless 10-key keypad.

We liked it so much that we bought a new wireless keypad from MC Saite for our backup system. It worked exactly the same.

We can't promise it will work on any keypad, but we suspect it should.

We're using it with six different layouts that automatically switch based on the application we're using. Here are the keypad layouts that pop up to remind us how the keys are defined:

INSTALLATION

There are two macros to be installed in the Global Macro group or equivalent so they are always available.

  • SpeedKeys Layout contains a Custom HTML action for each set of keys (or layout) and code to display that window when the Period key on the keypad is pressed. When the key is released, the window is closed.

  • SpeedKeys Definitions contains the hot key triggers for all but the Delete and Enter keys of the keypad in various sets. A default, inactive set is included as well as code to switch between sets and toggle Auto Switching when ⌃-Escape is pressed.

One global variable (SpeedKeys) is used to indicate the current layout, which also remembers if automatic layout switching has been enabled.

The layouts included are examples that won't necessarily run on your system because they reference macros and applications on my system.

DEFINING & DISPLAYING

Defining and displaying the layouts are independent operations.

In other words, the Period key display is not created from the actual key definitions. It's just a pretty picture you paint to remind you of those definitions.

I find it easiest to start with the picture, using SpeedKeys Layout to create a scheme. I review it using the Try button in Keyboard Maestro Editor and leave it on the screen when I move to SpeedKeys Definitions to actually attach the macros and actions to the keys.

You can define the keys to do anything that Keyboard Maestro does, including activating applications, opening files, displaying a palette of macros, running a macro and anything else.

Because they are hot key triggers, the keypad keystroke is swallowed and won't appear in a text document, as it would were the triggers USB device triggers.

DISPLAY HTML

To create the keypad display, HTML and CSS are used in a Custom HTML Prompt. Here's all you need to know to customize the look of the keypad display:

  • Background color: In the CSS section at the top of the code, change the tag's background-color.

  • Key color: The CSS includes several colors for keycaps depending on their function: app, key, pal, unk, def. These are applied in the HTML table of keys by changing the class name.

  • Key name: In the HTML table, the text between the <td> tags is what appears in the keypad display.

To get a head start on a display, duplicate the Default display at the bottom of the Switch action.

To check your work, use the Try button to display the HTML. Keep it on screen while you define the layout in the SpeedKeys Definitions macro.

Layouts vary in their storage requirements depending on several factors but tend to be in the 20K range each. Not very demanding, in short.

DEFINITIONS

When you add a layout to the SpeedKeys Definitions macro, you have to make several edits.

  • In the first action, add the new layout name to the list of options delineated by the <option> tag.

  • Associate the new definitions with a particular app by adding it to the Switch action's list linking the localApp to the localLayout variables.

  • In the localLayout Switch action, create a new option with the name of your new layout.

  • Copy the Default definitions action to that option and edit the macros, actions, etc. for each key position.

FIRST RUN

When you first run SpeedKeys, the global SpeedKeys variable will not be set so nothing will happen. Just use ⌃-Escape to set it using SpeedKeys Layout. Then your keypad will know how to behave.

SpeedKeys Layout will show you the current layout in its popup list and the current state of the auto switching option.

AUTO SWITCHING

SpeedKeys Definitions can be switched automatically based on the active application. So when you switch to BBEdit, for example, the keypad will switch to the layout for Editing. And when you switch to Finder, it will switch to the Finder layout. And so on for any other application or set of applications you group that have their own layouts.

To enable this feature, press ^-Escape and select Auto Switching. When you press the Period key on the keypad, you'll see a message at the bottom indicating it is now on.

If an application doesn't have a layout, the General layout is used.

Not all layouts may be switched to, though. You can have specialized ones for specific task. In that case, you just select the layout after pressing ^-Escape and it will remain active no matter what application you're using. And the message at the bottom of the layout shown with the Period key will indicate Auto Switching is off.

FILES

I'm just sharing my two working macros rather than make and maintain a set for distribution. So prepare to delete a lot of it and edit the rest to run on your system with your apps and your macros.

MacroApp: SpeedKeys Macros.kmmacros (144.7 KB)

[Revised. Completed Design text cursor navigation, fixed a Switching status display bug]

HELP

Happy to answer questions here.

17 Likes

Today I tested SpeedKeys on keyboard with the numeric keypad built in and found that SpeedKeys works on that keypad too. It redefines the numeric keypad just as it does a separate wired or wireless keypad.

2 Likes

In A Keypad for Photoshop, I detail setting up SpeedKeys with simple menu commands and AppleScripts to run Photoshop Actions. I also give more detail on the hardware.

2 Likes

Very creative. Well done!

1 Like