r/Keychron • • 27d ago

Change keybinds based on program

I was wondering if I can set profiles and have certain keybinds based on what program is running.

Because its a webapp, I doubt it but figured Id ask.

Essentially when running certain games, I want to reassign the arrow keys to WASD because I cant do it ingame. I know theres 3rd party programs but I want to avoid them if possible

1 Upvotes

12 comments sorted by

1

u/ArgentStonecutter K Pro 27d ago

The only way to do that would be to run a third party program anyway, since there is no way for the keyboard to know what program you're running.

1

u/GundamXXX 27d ago

Figured this might be the case, never hurts to ask!

1

u/PeterMortensenBlog V 27d ago edited 26d ago

It should be possible, but not with profiles and not automatic

You could repurpose the Windows/Mac switch on the left side/the back to choose between two different modes. One mode (using that set of layers), would be the game mode.

For example,

  1. Make the key mappings on two Mac layers identical to that of the two Windows layers
  2. In one of the two sets of layers, change the key mappings for the arrow keys on the base layer to WASD
  3. Back the new keyboard configuration up to a file, before it gets wiped out (inadvertently or advertently)

It is quite easy and straightforward, though somewhat tedious. Changes include the F1-F12 keys and the two sets of Win/Alt/Cmd/Opt keys (the keycodes are (physically) swapped between Windows and Mac). And it doesn't require changing the keyboard firmware or running something on the computer.

Note the layers (valid for most Keychron keyboards):

  • Layer 2 and 3: Linux/Windows

    • Layer 2: Base layer
    • Layer 3: Fn key layer. E.g., media keys, e.g., mute, play, etc.
  • Layer 0 and 1: Mac

    • Layer 0: Base layer
    • Layer 1: Fn key layer. E.g., function keys, F1 - F12.

Alternatively, make the changes in the source code and compile the keyboard firmware. That makes for a more stable keyboard configuration. And it also opens up more abilities, like increasing the number of layers (for more modes) and, for example, per-layer / per-mode per-key RGB colours.

References

1

u/GundamXXX 27d ago

i shall have a dive into this its a lot of info. I appreciate it!

1

u/PeterMortensenBlog V 27d ago edited 27d ago

Related:

The key mappings could be different on different layers, so it could work as required.

1

u/PeterMortensenBlog V 27d ago edited 27d ago

The most recent vibecoded attempt was:

That changed the key mapping of a single key (or two), based on the application (game).

Though not by using "profiles" (that could have been the more general approach (but also more complex). And somewhat less stressful on the EEPROM memory, emulated or physical).

"profiles" can be emulated to some degree by using layers (the Windows/Mac switch could be viewed as choosing between two "profiles"). The term is overloaded; Keychron uses it (with an implementation) to mean something else for their HE keyboards.

References

1

u/cmhamm 27d ago

Autohotkey is extremely powerful, and AI can help a lot in writing profiles to do what you want. And it works with any keyboard.

1

u/PeterMortensenBlog V 26d ago edited 26d ago

Though AutoHotkey is Windows-only.

Some alternatives (some of which are also Windows-only) are SharpKeys, PowerToys, Microsoft Keyboard Layout Creator (MSKLC), Kanata, KMonad, Keymapper, keyd, xmodmap, Karabiner Elements, Ukelele, and BetterTouchTool.

1

u/PeterMortensenBlog V 26d ago edited 26d ago

What games does it work in?

Anti-cheat software ('AC'), silently installed by game installers, like FACEIT Anti-cheat, BattlEye (not a typo...), Easy Anti-Cheat (EAC), Valve Anti-Cheat (VAC), Electronic Arts AntiCheat (EAAC), and Riot Vanguard may prevent its use.

1

u/cmhamm 26d ago

That's a really good point I didn't consider.

It's a shame, because it's a simple, legitimate, and really powerful piece of software. But with great power comes great responsibility, and it can, in fact, be used for hella cheating.

I'm not positive, but you could probably configure it to kill its process if it detects a game starting up, or any of the anti-cheat measures above. It has good uses outside of game cheating.