Skip to content

Keymap examples

hasu@tmk edited this page Jul 1, 2022 · 26 revisions

Keymap ideas and examples

SmartAltFn

When LALT is pressed, keys ijkl become arrow keys(up, left, down, right) and uohn becomes nagvigation keys (home, end, pageup, pagedown). But if you press alt with other key, it acts as it should be (that means you can still use alt+tab to switch window and alt+f to open a menu). The code please refer https://github.com/chenzhihuai1990/tmk_keyboard/blob/master/keyboard/hhkb/keymap_smartalt.c

CONS: You can use combination such as alt+h to open help.

PROS: You have any thing like SpaceFN while need not to tolerate with space delay.

SpaceFN

Essence of the idea is changing keymap layer by thumb using feature called Dual role key. Key layout may vary for preference.

Dual role key is called Tap key in TMK. You can use ACTION_LAYER_TAP_KEY for this like below:

ACTION_LAYER_TAP_KEY(1, Space)

Refer to this thread(https://geekhack.org/index.php?topic=51069.0) on GeekHack for SpaceFN.

Keymap Editor example: https://bit.ly/3licBwS

Code

TBD

Keymap Editor

SpaceFN layout: https://goo.gl/aFmnbY

This link itself is for HHKB but you can select your TMK product in 'Base Firmware File' to download proper firmware.

Reverse-shifted for numbers

With pressing Shift and '1' key you get 1 while with just '1' key you get !.

KBT Pure layout

Keymap code on Alps64 https://github.com/thisisshi/tmk_keyboard/blob/15fe63e8d181a8a95988dcc71929f0024df55caa/keyboard/alps64/keymap_pure.c

and guide. https://github.com/thisisshi/tmk_keyboard/blob/77ac0805ade565fb23657e3644c920ada71edccf/keyboard/alps64/Guide.md

Mouse keys with SpaceFn

Keymap editor link: hasu's on Alps64

Programmer's layers on German layout

https://geekhack.org/index.php?topic=41989.msg2218160#msg2218160 http://www.keyboard-layout-editor.com/#/gists/3f4485a4bef29532c9d25c522d221037

Keymap code: https://gist.github.com/tmk/daa925e817cb2a80cd5bc55c4c7c81bd

Colemak

Plain Colemak layout on Keymap Editor

You will be able to use this as starting point. https://goo.gl/t2b5W4

Colemak and extended layout by DreymaR

https://forum.colemak.com/topic/2158-dreymars-big-bag-of-keyboard-tricks-usb2usb-edition/#p18407

Colemak keymap file for HHKB JP

https://github.com/tmk/tmk_keyboard/pull/577 https://github.com/tmk/tmk_keyboard/blob/924ae8be4f668e99c95c585fbf3025013d2fee9d/keyboard/hhkb/keymap_jp_colemak.c

QWERTY on AZERTY host

This is intended to use QWERTY layout forcibly somehow on host where AZERTY keyboard is expected. The keymap is tricky due to TMK key action limitation and craziness of AZERTY. This issue may mitigate this in future.

https://geekhack.org/index.php?topic=69169.msg2592504#msg2592504

Keymap Editor link: https://goo.gl/zz2DUx

Vim arrow

I make vim arrow keymap (Control + H, J, K, L to left, down, up, right arrows)

https://github.com/tmk/tmk_keyboard/pull/555

Share you idea here

Space-Fn locking

Would be great to make a space-fn keymap, with locking mecanism. If you need your secondary layer for one key, you "space-key" what you need. But if you need much more (say, you have numpad on the secondary layer) keystrokes, you space-lock it, use whatever strokes you need (make your computation on your virtual numpad), and unlock it when you're done. I think we could do it using:

  • Momentary layer switching on space bar
  • Tap action for actual "space" on primary layer
  • Permanent layer toggle on secondary layer, on the lock key
  • Tap action for "space" on secondary layer to return to primary Is it doable? Is it the right way? Bonus: With two space bars (think Atreus with both thumbs on space), you could implement fn1 on left with locking on right, fn2 on right with locking on left, and unlock on both...

Flash LED on key presses

It turns on Leds for 100ms when any key is pressed, for a fun. You can add this code to your keymap file

diff --git a/keyboard/fc660c/unimap.c b/keyboard/fc660c/unimap.c
index 77c3350..9dbd04c 100644
--- a/keyboard/fc660c/unimap.c
+++ b/keyboard/fc660c/unimap.c
@@ -17,3 +17,21 @@ const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = {
         LCTL,LGUI,LALT,          SPC,                     RALT,RCTL,GRV, LEFT,DOWN,RGHT
     ),
 };
+
+
+#define LED_ON()        PORTB &= ~(1<<5 | 1<<6)
+#define LED_OFF()       PORTB |=  (1<<5 | 1<<6)
+#define LED_DURATION    100
+static uint16_t last_ms = 0;
+void hook_matrix_change(keyevent_t event) {
+    if (event.pressed) {
+        LED_ON();
+        last_ms = timer_read();
+    }
+}
+
+void hook_keyboard_loop(void) {
+    if (TIMER_DIFF_16(last_ms, timer_read()) > LED_DURATION) {
+        LED_OFF();
+    }
+}

https://geekhack.org/index.php?topic=88439.msg2606655#msg2606655

Shift Parentheses

steve losh's Shift Parentheses

You can input '(' and ')' with tapping left and right shift key.

https://github.com/tmk/tmk_keyboard/discussions/744

Clone this wiki locally