Introduce ___ and XXX aliases

To make keymaps look nicer, easier to read, introduce the `___` and `XXX`
aliases. The former is an alias to `Key_Transparent`, the latter to `Key_NoKey`.

The `genetare_keymaps.pl` tool was updated to support these, too, with the
additional functionality, that all strings that are made up entirely of
underscore or Xes, and are two or more characters long, will be treated as
`___`/`XXX`, respectively. This makes it possible to space keys in a nicer way
in the source layout files.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/57/head
Gergely Nagy 8 years ago
parent 12710d6cc0
commit e72867fe68

@ -10,10 +10,10 @@
{Key_PageDn, Key_Semicolon, Key_Q, Key_J, Key_K, Key_X, Key_Esc, Key_Keymap2, Key_B, Key_M, Key_W, Key_V, Key_Z, Key_Equals},\
{Key_LCtrl, Key_Backspace, Key_LShift, Key_LGUI, Key_KeymapNext_Momentary, Key_skip, Key_skip, Key_skip, Key_skip, Key_KeymapNext_Momentary, Key_RAlt, Key_RShift, Key_Space, Key_RCtrl},\
},
#define KEYMAP_GENERIC_FN2 { /* Generated keymap for GENERIC_FN2 */ {Key_skip, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_NoKey, Key_LCtrl, Key_RCtrl, Key_NoKey, Key_F6, Key_F7, Key_F8, Key_F9, Key_Trans, Key_skip},\
{Key_Tab, Key_mouseBtnM, Key_mouseUp, Key_skip, Key_mouseWarpNW, Key_mouseWarpNE, Key_NoKey, Key_mouseBtnL, Key_mouseBtnR, Key_NoKey, Key_playPause, Key_LCurlyBracket, Key_RCurlyBracket, Key_LSquareBracket, Key_RSquareBracket, Key_sleep},\
#define KEYMAP_GENERIC_FN2 { /* Generated keymap for GENERIC_FN2 */ {Key_skip, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, XXX, Key_LCtrl, Key_RCtrl, XXX, Key_F6, Key_F7, Key_F8, Key_F9, ___, Key_skip},\
{Key_Tab, Key_mouseBtnM, Key_mouseUp, Key_skip, Key_mouseWarpNW, Key_mouseWarpNE, XXX, Key_mouseBtnL, Key_mouseBtnR, XXX, Key_playPause, Key_LCurlyBracket, Key_RCurlyBracket, Key_LSquareBracket, Key_RSquareBracket, Key_sleep},\
{Key_Home, Key_mouseL, Key_mouseDn, Key_mouseR, Key_mouseWarpSW, Key_mouseWarpSE, Key_nextTrack, Key_LGUI, Key_RAlt, Key_Delete, Key_LArrow, Key_DnArrow, Key_UpArrow, Key_RArrow, Key_F11, Key_F12},\
{Key_End, Key_Z, Key_X, Key_C, Key_V, Key_mouseWarpEnd, Key_Trans, Key_LShift, Key_RShift, Key_Trans, Key_volumeDown, Key_volumeUp, Key_BacklightDn, Key_BacklightUp, Key_Backslash, Key_Pipe},\
{Key_End, Key_Z, Key_X, Key_C, Key_V, Key_mouseWarpEnd, ___, Key_LShift, Key_RShift, ___, Key_volumeDown, Key_volumeUp, Key_BacklightDn, Key_BacklightUp, Key_Backslash, Key_Pipe},\
},
#define KEYMAP_GENERIC_FN2_MOO { /* Generated keymap for GENERIC_FN2_MOO */ {Key_skip, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_NoKey, Key_LCtrl, Key_RCtrl, Key_NoKey, Key_F6, Key_F7, Key_F8, Key_F9, Key_Keymap0, Key_skip},\
{Key_Tab, Key_mouseBtnM, Key_mouseUp, Key_skip, Key_mouseWarpNW, Key_mouseWarpNE, Key_NoKey, Key_mouseBtnL, Key_mouseBtnR, Key_NoKey, Key_playPause, Key_LCurlyBracket, Key_RCurlyBracket, Key_LEFT_PAREN, Key_RIGHT_PAREN, Key_sleep},\
@ -26,10 +26,10 @@
{Key_PageDn, Key_Comma, Key_Period, Key_J, Key_G, Key_Slash, Key_Esc, Key_Keymap2, Key_Semicolon, Key_W, Key_K, Key_Minus, Key_X, Key_LSquareBracket},\
{Key_LGUI, Key_E, Key_LShift, Key_Backspace, Key_KeymapNext_Momentary, Key_skip, Key_skip, Key_skip, Key_skip, Key_KeymapNext_Momentary, Key_RCtrl, Key_RShift, Key_Space, Key_RAlt},\
},
#define KEYMAP_NUMPAD { /* Generated keymap for NUMPAD */ {Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Keypad7, Key_Keypad8, Key_Keypad9, Key_KeypadMinus, Key_Trans},\
{Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Keymap1_Momentary, Key_Trans, Key_Trans, Key_Keymap1_Momentary, Key_Trans, Key_Keypad4, Key_Keypad5, Key_Keypad6, Key_KeypadPlus, Key_Trans},\
{Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Keypad1, Key_Keypad2, Key_Keypad3, Key_Equals, Key_Quote},\
{Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Trans, Key_Keypad0, Key_KeypadDot, Key_KeypadMultiply, Key_KeypadSlash, Key_Enter},\
#define KEYMAP_NUMPAD { /* Generated keymap for NUMPAD */ {___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad7, Key_Keypad8, Key_Keypad9, Key_KeypadMinus, ___},\
{___, ___, ___, ___, ___, ___, Key_Keymap1_Momentary, ___, ___, Key_Keymap1_Momentary, ___, Key_Keypad4, Key_Keypad5, Key_Keypad6, Key_KeypadPlus, ___},\
{___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad1, Key_Keypad2, Key_Keypad3, Key_Equals, Key_Quote},\
{___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad0, Key_KeypadDot, Key_KeypadMultiply, Key_KeypadSlash, Key_Enter},\
},
#define KEYMAP_QWERTY { /* Generated keymap for QWERTY */ {Key_LEDEffectNext, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, Key_LCtrl, Key_RCtrl, Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_Keymap2},\
{Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab, Key_Backspace, Key_Space, Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals},\

@ -1,5 +1,5 @@
#NAME: GENERIC_FN2
skip F1 F2 F3 F4 F5 NoKey LCtrl RCtrl NoKey F6 F7 F8 F9 Trans skip
Tab mouseBtnM mouseUp skip mouseWarpNW mouseWarpNE NoKey mouseBtnL mouseBtnR NoKey playPause { } [ ] sleep
skip F1 F2 F3 F4 F5 XXXXXXXXX LCtrl RCtrl XXXXXX F6 F7 F8 F9 ___ skip
Tab mouseBtnM mouseUp skip mouseWarpNW mouseWarpNE XXXXXXXXX mouseBtnL mouseBtnR XXXXXX playPause { } [ ] sleep
Home mouseL mouseDn mouseR mouseWarpSW mouseWarpSE nextTrack LGUI RAlt Delete LArrow DnArrow UpArrow RArrow F11 F12
End Z X C V mouseWarpEnd Trans LShift RShift Trans volumeDown volumeUp BacklightDn BacklightUp \ |
End Z X C V mouseWarpEnd _________ LShift RShift ______ volumeDown volumeUp BacklightDn BacklightUp \ |

@ -1,5 +1,5 @@
#NAME: NUMPAD
Trans Trans Trans Trans Trans Trans Trans Trans Trans Trans Trans Keypad7 Keypad8 Keypad9 KeypadMinus Trans
Trans Trans Trans Trans Trans Trans Keymap1_Momentary Trans Trans Keymap1_Momentary Trans Keypad4 Keypad5 Keypad6 KeypadPlus Trans
Trans Trans Trans Trans Trans Trans Trans Trans Trans Trans Trans Keypad1 Keypad2 Keypad3 Equals '
Trans Trans Trans Trans Trans Trans Trans Trans Trans Trans Trans Keypad0 KeypadDot KeypadMultiply KeypadSlash Enter
___ ___ ___ ___ ___ ___ _________________ ___ ___ _________________ ___ Keypad7 Keypad8 Keypad9 KeypadMinus ___
___ ___ ___ ___ ___ ___ Keymap1_Momentary ___ ___ Keymap1_Momentary ___ Keypad4 Keypad5 Keypad6 KeypadPlus ___
___ ___ ___ ___ ___ ___ _________________ ___ ___ _________________ ___ Keypad1 Keypad2 Keypad3 Equals '
___ ___ ___ ___ ___ ___ _________________ ___ ___ _________________ ___ Keypad0 KeypadDot KeypadMultiply KeypadSlash Enter

@ -58,6 +58,8 @@ typedef union {
#define Key_NoKey (Key){ KEY_FLAGS,0 }
#define Key_skip (Key){ KEY_FLAGS,0 }
#define Key_Transparent (Key){ .raw = 0xffff }
#define ___ Key_Transparent
#define XXX Key_NoKey
#define Key_powerDown (Key) {KEY_FLAGS | SYNTHETIC|IS_SYSCTL,HID_SYSTEM_POWER_DOWN }

@ -41,10 +41,15 @@ my %table = (
"'" => 'Key_Quote',
'`' => 'Key_Backtick',
'-' => 'Key_Minus',
'=' => 'Key_Equals');
'=' => 'Key_Equals',
'___' => '___',
'XXX' => 'XXX');
my $x = shift;
return $x if $x =~ /\(.*\)/;
return '___' if ($x =~ /_{2,}/);
return 'XXX' if ($x =~ /X{2,}/);
return 'Key_'.$x unless defined $table{$x};
return $table{$x};
}

Loading…
Cancel
Save