-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
host_keymaps enable defining keymaps in a natural fashion. Instead of using Key constants like Key_A or LSHIFT(Key_A) it allows to conveniently write "a" or "A". The mappings between ascii and unicode characters to USB-HID keys works by reverse engineering the host keymaps of a linux system. The information of the provided keymap files allows for precisely figuring out the Kaleidoscope-Key that is needed to generate a specific utf8 character in a given keymap. For non-unicode keycodes, the linux XKB-keysym name is mapped to a Kaleidoscope-Key. The newly introduced host_keymap system is easily extensible and allows users to define their own non-english keymaps, if necessary by extending an existing keymap. Signed-off-by: Florian Fleissner <florian.fleissner@inpartik.de>
- Loading branch information
Florian Fleissner
committed
Nov 15, 2019
1 parent
ca8be53
commit 325c42e
Showing
643 changed files
with
313,609 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* -*- mode: c++ -*- | ||
* Kaleidoscope-Unicode -- Unicode input helpers | ||
* Copyright (C) 2016, 2017, 2018 Keyboard.io, Inc | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License as published by the Free Software | ||
* Foundation, version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <Kaleidoscope.h> | ||
|
||
#include "kaleidoscope/host_keymap/linux/us/standard/keymap.h" | ||
|
||
USE_HOST_KEYMAP(linux, us, standard) | ||
|
||
// *INDENT-OFF* | ||
|
||
KEYMAPS( | ||
[0] = KEYMAP_STACKED | ||
( | ||
XXX, "1", "2", "3", "4", "5", XXX, | ||
"`", "q", "w", "e", "r", "t", "\t", | ||
L"⇞", "a", "s", "d", "f", "g", | ||
L"⇟", "z", "x", "c", "v", "b", L"⎋", | ||
|
||
L"⌃", L"⌫", L"⌘", L"⇧", | ||
XXX, | ||
|
||
XXX, "6", "7", "8", "9", "0", XXX, | ||
L"⎆", "y", "u", "i", "o", "p", "=", | ||
"h", "j", "k", "l", ";", "\"", | ||
XXX, "n", "m", ",", ".", "/", "-", | ||
|
||
L"r⇧", L"r⌥", L"␣", L"r⌃", | ||
XXX | ||
) | ||
) | ||
// *INDENT-ON* | ||
|
||
//KALEIDOSCOPE_INIT_PLUGINS(); | ||
|
||
void setup() { | ||
Kaleidoscope.setup(); | ||
} | ||
|
||
void loop() { | ||
Kaleidoscope.loop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The linux keymaps were generated on an Ubuntu 19.04 system based on XKeyboardConfig 2.23. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* Kaleidoscope - Firmware for computer input devices | ||
* Copyright (C) 2013-2018 Keyboard.io, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License as published by the Free Software | ||
* Foundation, version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "kaleidoscope/host_keymap/host_keymap.h" | ||
|
||
namespace kaleidoscope { | ||
namespace host_keymap { | ||
namespace ascii { | ||
|
||
struct CharProcessor { | ||
static constexpr bool isEscapeChar(char c) { | ||
return c == '#'; | ||
} | ||
|
||
static constexpr bool isSeparator(char c) { | ||
return (c == ' ') | ||
|| (c == '\t') | ||
|| (c == '+'); | ||
} | ||
|
||
static constexpr bool isMirrorChar(char c) { | ||
return c == 'r'; | ||
} | ||
}; | ||
|
||
#define _HOST_KEYMAP_CAST_ON_MODIFIERS_ASCII(OP) \ | ||
OP('s', LSHIFT(k)) \ | ||
OP('S', LSHIFT(k)) \ | ||
OP('c', LCTRL(k)) \ | ||
OP('C', LCTRL(k)) \ | ||
OP('a', LALT(k)) \ | ||
OP('A', RALT(k)) \ | ||
OP('m', LGUI(k)) \ | ||
OP('M', LGUI(k)) \ | ||
OP('g', LGUI(k)) \ | ||
OP('G', LGUI(k)) | ||
|
||
// Define a AsciiConverterBase template base class that any ascii keymap converters | ||
// are derived from by means of invoking the HOST_KEYMAP_ASCII_LANGUAGE_CONVERTER | ||
// function macro. | ||
// | ||
_HOST_KEYMAP_DEFINE_CHAR_CONVERTER( | ||
ConverterBase, char, _HOST_KEYMAP_CAST_ON_MODIFIERS_ASCII) | ||
|
||
#undef _HOST_KEYMAP_CAST_ON_MODIFIERS_ASCII | ||
|
||
typedef _CharParsingStandardFallback<char> CharParsingStandardFallback; | ||
|
||
} // namespace ascii | ||
} // namespace host_keymap | ||
} // namespace kaleidoscope | ||
|
||
#define HOST_KEYMAP_ASCII_CONVERTER(LANGUAGE_KEYMAP, CHAR_PARSING_FALLBACK) \ | ||
struct AsciiConverter \ | ||
: public ascii::ConverterBase<AsciiConverter, ascii::CharProcessor> \ | ||
{ \ | ||
typedef ascii::ConverterBase<AsciiConverter, ascii::CharProcessor> Parent; \ | ||
\ | ||
using typename Parent::StringMemberType; \ | ||
using typename Parent::CharType; \ | ||
\ | ||
static constexpr bool isKeyChar(char c) { \ | ||
return LANGUAGE_KEYMAP(_HOST_KEYMAP_IS_KEY_CHAR) \ | ||
CHAR_PARSING_FALLBACK::isKeyChar(c); \ | ||
} \ | ||
\ | ||
static constexpr Key charToKey(char c) { \ | ||
return LANGUAGE_KEYMAP( \ | ||
_HOST_KEYMAP_MAP_KEY_CHAR_TO_KALEIDOSCOPE_KEY \ | ||
) \ | ||
CHAR_PARSING_FALLBACK::charToKey(c); \ | ||
} \ | ||
}; \ | ||
\ | ||
constexpr Key convertToKey(char c) { \ | ||
return AsciiConverter::convertToKey(c); \ | ||
} \ | ||
template<int _Size> \ | ||
constexpr Key convertToKey(char const(&string) [_Size]) { \ | ||
return AsciiConverter::convertToKey(string); \ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* Kaleidoscope - Firmware for computer input devices | ||
* Copyright (C) 2013-2018 Keyboard.io, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License as published by the Free Software | ||
* Foundation, version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "kaleidoscope/host_keymap/ascii.h" | ||
#include "kaleidoscope/host_keymap/unicode.h" | ||
#include "kaleidoscope/host_keymap/non_printable.h" |
Oops, something went wrong.