]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - FAQ-Keymap.md
Updated License Clarification (markdown)
[qmk_firmware.git] / FAQ-Keymap.md
index 4974cbc3a9ea1c1a30c49d439d0cd55b23e5f92b..a26461c01cf9ba617ad72e536b93624f35303526 100644 (file)
@@ -1,9 +1,9 @@
 ## READ FIRST
 ## READ FIRST
-https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md
+https://github.com/tmk/tmk_core/blob/master/doc/keymap.md
 
 ## How to get keycode
 
 ## How to get keycode
-See [doc/keycode.txt](https://github.com/tmk/tmk_keyboard/blob/master/doc/keycode.txt).
-Keycodes are actually defined in [common/keycode.h](https://github.com/tmk/tmk_keyboard/blob/master/common/keycode.h).
+See [doc/keycode.txt](https://github.com/tmk/tmk_core/blob/master/doc/keycode.txt).
+Keycodes are actually defined in [common/keycode.h](https://github.com/tmk/tmk_core/blob/master/common/keycode.h).
 
 ## Sysrq key
 Use keycode for Print Screen(`KC_PSCREEN` or `KC_PSCR`) instead of `KC_SYSREQ`. Key combination of 'Alt + Print Screen' is recognized as 'System request'.
 
 ## Sysrq key
 Use keycode for Print Screen(`KC_PSCREEN` or `KC_PSCR`) instead of `KC_SYSREQ`. Key combination of 'Alt + Print Screen' is recognized as 'System request'.
@@ -27,7 +27,7 @@ https://github.com/tmk/tmk_keyboard/issues/67
 Modifier keys or layers can be stuck unless layer switching is configured properly.
 For Modifier keys and layer actions you have to place `KC_TRANS` on same position of destination layer to  unregister the modifier key or return to previous layer on release event.
 
 Modifier keys or layers can be stuck unless layer switching is configured properly.
 For Modifier keys and layer actions you have to place `KC_TRANS` on same position of destination layer to  unregister the modifier key or return to previous layer on release event.
 
-- https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#31-momentary-switching
+- https://github.com/tmk/tmk_core/blob/master/doc/keymap.md#31-momentary-switching
 - http://geekhack.org/index.php?topic=57008.msg1492604#msg1492604
 - https://github.com/tmk/tmk_keyboard/issues/248
 
 - http://geekhack.org/index.php?topic=57008.msg1492604#msg1492604
 - https://github.com/tmk/tmk_keyboard/issues/248
 
@@ -64,11 +64,11 @@ And see this for **Unicode** input.
 - http://en.wikipedia.org/wiki/Unicode_input
 
 
 - http://en.wikipedia.org/wiki/Unicode_input
 
 
-### Apple keyboard Fn
+## Apple/Mac keyboard Fn
 Not supported.
 
 Not supported.
 
-Apple keyboard sends keycode for Fn unlike most of other keyboards.
-I think you can send Apple Fn key using Apple venter specific Page 0xff00 and usage 0x0003. But you have to change HID Report Descriptor for this, of course.
+Apple/Mac keyboard sends keycode for Fn unlike most of other keyboards.
+I think you can send Apple Fn key using Apple venter specific Page 0xff01 and usage 0x0003. But you have to change HID Report Descriptor for this, of course.
 
 https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-606.1.7/IOHIDFamily/AppleHIDUsageTables.h
 
 
 https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-606.1.7/IOHIDFamily/AppleHIDUsageTables.h
 
@@ -114,7 +114,7 @@ https://github.com/tekezo/Karabiner/issues/403
 
 
 You can define FC660 and Poker style ESC with `ACTION_LAYER_MODS`.
 
 
 You can define FC660 and Poker style ESC with `ACTION_LAYER_MODS`.
-https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#35-momentary-switching-with-modifiers
+https://github.com/tmk/tmk_core/blob/master/doc/keymap.md#35-momentary-switching-with-modifiers
 
 ```
 #include "keymap_common.h"
 
 ```
 #include "keymap_common.h"
@@ -153,7 +153,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 };
 
 const uint16_t PROGMEM fn_actions[] = {
 };
 
 const uint16_t PROGMEM fn_actions[] = {
-    // https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#35-momentary-switching-with-modifiers
+    // https://github.com/tmk/tmk_core/blob/master/doc/keymap.md#35-momentary-switching-with-modifiers
     [0] = ACTION_LAYER_MODS(1, MOD_LSFT),
     [1] = ACTION_LAYER_MOMENTARY(2),
 };
     [0] = ACTION_LAYER_MODS(1, MOD_LSFT),
     [1] = ACTION_LAYER_MOMENTARY(2),
 };
@@ -180,7 +180,7 @@ This turns right modifer keys into arrow keys when the keys are tapped while sti
 
 /* Arrow keys on right modifier keys with TMK dual role feature
  *
 
 /* Arrow keys on right modifier keys with TMK dual role feature
  *
- *  https://github.com/tmk/tmk_keyboard/blob/master/doc/keymap.md#213-modifier-with-tap-keydual-role
+ *  https://github.com/tmk/tmk_core/blob/master/doc/keymap.md#213-modifier-with-tap-keydual-role
  *  https://en.wikipedia.org/wiki/Modifier_key#Dual-role_keys
  */
 const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  *  https://en.wikipedia.org/wiki/Modifier_key#Dual-role_keys
  */
 const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -218,4 +218,32 @@ Dual-role key: https://en.wikipedia.org/wiki/Modifier_key#Dual-role_keys
 
 
 ## Eject on Mac OSX
 
 
 ## Eject on Mac OSX
-It is actually F20, at least HHKB use it for Eject key(Fn+f).
\ No newline at end of file
+`EJCT` keycode works on OSX. https://github.com/tmk/tmk_keyboard/issues/250
+It seems Windows 10 ignores the code and Linux/Xorg recognizes but has no mapping by default.
+
+Not sure what keycode Eject is on genuine Apple keyboard actually. HHKB uses `F20` for Eject key(`Fn+f`) on Mac mode but this is not same as Apple Eject keycode probably.
+
+
+
+## What's weak_mods and real_mods in action_util.c
+___TO BE IMPROVED___
+
+real_mods is intended to retains state of real/physical modifier key state, while
+weak_mods retains state of virtual or temprary modifiers which should not affect state real modifier key.
+
+Let's say you hold down physical left shift key and type ACTION_MODS_KEY(LSHIFT, KC_A), 
+
+with weak_mods,
+* (1) hold down left shift: real_mods |= MOD_BIT(LSHIFT)
+* (2) press ACTION_MODS_KEY(LSHIFT, KC_A): weak_mods |= MOD_BIT(LSHIFT)
+* (3) release ACTION_MODS_KEY(LSHIFT, KC_A): waek_mods &= ~MOD_BIT(LSHIFT)
+real_mods still keeps modifier state.
+
+without weak mods,
+* (1) hold down left shift: real_mods |= MOD_BIT(LSHIFT)
+* (2) press ACTION_MODS_KEY(LSHIFT, KC_A): real_mods |= MOD_BIT(LSHIFT)
+* (3) release ACTION_MODS_KEY(LSHIFT, KC_A): real_mods &= ~MOD_BIT(LSHIFT)
+here real_mods lost state for 'physical left shift'.
+
+weak_mods is ORed with real_mods when keyboard report is sent.
+https://github.com/tmk/tmk_core/blob/master/common/action_util.c#L57