From e190872b822f247794213120e0f7a276c07c95b9 Mon Sep 17 00:00:00 2001 From: Joshua Diamond Date: Fri, 1 Jan 2021 23:54:48 -0500 Subject: [PATCH] Improved Language Specific Keycodes for US International and Extended Layouts (#11307) Co-authored-by: Ryan --- docs/reference_keymap_extras.md | 2 + quantum/keymap_extras/keymap_us_extended.h | 227 ++++++++++++++++++ .../keymap_extras/keymap_us_international.h | 20 +- .../keymap_us_international_linux.h | 224 +++++++++++++++++ .../sendstring_us_international.h | 100 ++++++++ quantum/quantum.c | 33 ++- quantum/quantum.h | 1 + 7 files changed, 594 insertions(+), 13 deletions(-) create mode 100644 quantum/keymap_extras/keymap_us_extended.h create mode 100644 quantum/keymap_extras/keymap_us_international_linux.h create mode 100644 quantum/keymap_extras/sendstring_us_international.h diff --git a/docs/reference_keymap_extras.md b/docs/reference_keymap_extras.md index f2abb4e59..40a195684 100644 --- a/docs/reference_keymap_extras.md +++ b/docs/reference_keymap_extras.md @@ -18,7 +18,9 @@ To use these, simply `#include` the corresponding [header file](https://github.c |Dutch (Belgium) |`keymap_belgian.h` | |English (Ireland) |`keymap_irish.h` | |English (UK) |`keymap_uk.h` | +|English (US Extended) |`keymap_us_extended.h` | |English (US International) |`keymap_us_international.h` | +|English (US International, Linux)|`keymap_us_international_linux.h`| |Estonian |`keymap_estonian.h` | |Finnish |`keymap_finnish.h` | |French |`keymap_french.h` | diff --git a/quantum/keymap_extras/keymap_us_extended.h b/quantum/keymap_extras/keymap_us_extended.h new file mode 100644 index 000000000..b2b3a734c --- /dev/null +++ b/quantum/keymap_extras/keymap_us_extended.h @@ -0,0 +1,227 @@ +/* Copyright 2020 + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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 . + */ + +#pragma once + +#include "keymap.h" + +// clang-format off + +/* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │       │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │     │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │  \  │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │      │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │        │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │        │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │          │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │    │    │    │                        │    │    │    │    │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ +// Row 1 +#define US_GRV KC_GRV // ` +#define US_1 KC_1 // 1 +#define US_2 KC_2 // 2 +#define US_3 KC_3 // 3 +#define US_4 KC_4 // 4 +#define US_5 KC_5 // 5 +#define US_6 KC_6 // 6 +#define US_7 KC_7 // 7 +#define US_8 KC_8 // 8 +#define US_9 KC_9 // 9 +#define US_0 KC_0 // 0 +#define US_MINS KC_MINS // - +#define US_EQL KC_EQL // = +// Row 2 +#define US_Q KC_Q // Q +#define US_W KC_W // W +#define US_E KC_E // E +#define US_R KC_R // R +#define US_T KC_T // T +#define US_Y KC_Y // Y +#define US_U KC_U // U +#define US_I KC_I // I +#define US_O KC_O // O +#define US_P KC_P // P +#define US_LBRC KC_LBRC // [ +#define US_RBRC KC_RBRC // ] +#define US_BSLS KC_BSLS // (backslash) +// Row 3 +#define US_A KC_A // A +#define US_S KC_S // S +#define US_D KC_D // D +#define US_F KC_F // F +#define US_G KC_G // G +#define US_H KC_H // H +#define US_J KC_J // J +#define US_K KC_K // K +#define US_L KC_L // L +#define US_SCLN KC_SCLN // ; +#define US_QUOT KC_QUOT // ' +// Row 4 +#define US_Z KC_Z // Z +#define US_X KC_X // X +#define US_C KC_C // C +#define US_V KC_V // V +#define US_B KC_B // B +#define US_N KC_N // N +#define US_M KC_M // M +#define US_COMM KC_COMM // , +#define US_DOT KC_DOT // . +#define US_SLSH KC_SLSH // / + +/* Shifted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │       │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │     │   │   │   │   │   │   │   │   │   │   │ { │ } │  |  │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │      │   │   │   │   │   │   │   │   │   │ : │ " │        │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │        │   │   │   │   │   │   │   │ < │ > │ ? │          │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │    │    │    │                        │    │    │    │    │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ +// Row 1 +#define US_TILD S(US_GRV) // ~ +#define US_EXLM S(US_1) // ! +#define US_AT S(US_2) // @ +#define US_HASH S(US_3) // # +#define US_DLR S(US_4) // $ +#define US_PERC S(US_5) // % +#define US_CIRC S(US_6) // ^ +#define US_AMPR S(US_7) // & +#define US_ASTR S(US_8) // * +#define US_LPRN S(US_9) // ( +#define US_RPRN S(US_0) // ) +#define US_UNDS S(US_MINS) // _ +#define US_PLUS S(US_EQL) // + +// Row 2 +#define US_LCBR S(US_LBRC) // { +#define US_RCBR S(US_RBRC) // } +#define US_PIPE S(US_BSLS) // | +// Row 3 +#define US_COLN S(US_SCLN) // : +#define US_DQUO S(US_QUOT) // " +// Row 4 +#define US_LABK S(US_COMM) // < +#define US_RABK S(US_DOT) // > +#define US_QUES S(US_SLSH) // ? + +/* AltGr symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │ ` │ ¹ │ ² │ ³ │ ¤ │ € │ ^ │ ̛  │ ¾ │ ‘ │ ’ │ ¥ │ × │       │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │     │ Ä │ Å │ É │ ® │ Þ │ Ü │ Ú │ Í │ Ó │ Ö │ « │ » │  ¬  │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │      │ Á │ ß │ Ð │   │   │   │ Ï │ Œ │ Ø │ ¶ │ ' │        │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │        │ Æ │   │ © │   │   │ Ñ │ µ │ Ç │ ˙ │ ¿ │          │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │    │    │    │                        │    │    │    │    │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ +// Row 1 +#define US_DGRV ALGR(US_GRV) // ` (dead) +#define US_SUP1 ALGR(US_1) // ¹ +#define US_SUP2 ALGR(US_2) // ² +#define US_SUP3 ALGR(US_3) // ³ +#define US_CURR ALGR(US_4) // ¤ +#define US_EURO ALGR(US_5) // € +#define US_DCIR ALGR(US_6) // ^ (dead) +#define US_HORN ALGR(US_7) // ̛̛ (dead) +#define US_OGON ALGR(US_8) // ˛ (dead) +#define US_LSQU ALGR(US_9) // ‘ +#define US_RSQU ALGR(US_0) // ’ +#define US_YEN ALGR(US_MINS) // ¥ +#define US_MUL ALGR(US_EQL) // × +// Row 2 +#define US_ADIA ALGR(US_Q) // Ä +#define US_ARNG ALGR(US_W) // Å +#define US_EACU ALGR(US_E) // É +#define US_EDIA ALGR(US_R) // Ë +#define US_THRN ALGR(US_T) // Þ +#define US_UDIA ALGR(US_Y) // Ü +#define US_UACU ALGR(US_U) // Ú +#define US_IACU ALGR(US_I) // Í +#define US_OACU ALGR(US_O) // Ó +#define US_ODIA ALGR(US_P) // Ö +#define US_LDAQ ALGR(US_LBRC) // « +#define US_RDAQ ALGR(US_RBRC) // » +#define US_NOT ALGR(US_BSLS) // ¬ +// Row 3 +#define US_AACU ALGR(US_A) // Á +#define US_SS ALGR(US_S) // ß +#define US_ETH ALGR(US_D) // Ð +#define US_IDIA ALGR(US_J) // Ï +#define US_OE ALGR(US_K) // Œ +#define US_OSTR ALGR(US_L) // Ø +#define US_PILC ALGR(US_SCLN) // ¶ +#define US_ACUT ALGR(US_QUOT) // ´ (dead) +// Row 4 +#define US_AE ALGR(US_Z) // Æ +#define US_OE_2 ALGR(US_X) // Œ +#define US_COPY ALGR(US_C) // © +#define US_REGD ALGR(US_V) // ® +#define US_NTIL ALGR(US_N) // Ñ +#define US_MICR ALGR(US_M) // µ +#define US_CCED ALGR(US_COMM) // Ç +#define US_DOTA ALGR(US_DOT) // ˙ (dead) +#define US_IQUE ALGR(US_SLSH) // ¿ + +/* Shift+AltGr symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │ ~ │ ¡ │ ˝ │ ¯ │ £ │ ¸ │ ¼ │ ½ │ ¾ │ ˘ │ ° │  ̣ │ ÷ │       │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │     │   │   │   │   │   │   │   │   │   │   │ “ │ ” │  ¦  │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │      │   │ § │   │   │   │   │   │   │   │ ° │ " │        │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │        │   │   │ ¢ │   │   │   │   │   │ ˇ │  ̉ │          │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │    │    │    │                        │    │    │    │    │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ +// Row 1 +#define US_DTIL S(ALGR(US_GRV)) // ~ (dead) +#define US_IEXL S(ALGR(US_1)) // ¡ +#define US_DACU S(ALGR(US_2)) // ˝ (dead) +#define US_MACR S(ALGR(US_3)) // ¯ (dead) +#define US_PND S(ALGR(US_4)) // £ +#define US_CEDL S(ALGR(US_5)) // ¸ (dead) +#define US_QRTR S(ALGR(US_6)) // ¼ +#define US_HALF S(ALGR(US_7)) // ½ +#define US_TQTR S(ALGR(US_8)) // ¾ +#define US_BREV S(ALGR(US_9)) // ˘ (dead) +#define US_RNGA S(ALGR(US_0)) // ° (dead) +#define US_DOTB S(ALGR(US_MINS)) // ̣ (dead) +#define US_DIV S(ALGR(US_EQL)) // ÷ +// Row 2 +#define US_LDQU S(ALGR(US_LBRC)) // “ +#define US_RDQU S(ALGR(US_LBRC)) // ” +#define US_BRKP S(ALGR(US_BSLS)) // ¦ +// Row 3 +#define US_SECT S(ALGR(US_S)) // § +#define US_DEG S(ALGR(US_SCLN)) // ° +#define US_DIAE S(ALGR(US_QUOT)) // ¨ (dead) +// Row 4 +#define US_CENT S(ALGR(US_C)) // ¢ +#define US_CARN S(ALGR(US_DOT)) // ˇ (dead) +#define US_HOKA S(ALGR(US_SLSH)) // ̉ (dead) + diff --git a/quantum/keymap_extras/keymap_us_international.h b/quantum/keymap_extras/keymap_us_international.h index a3bc46597..49afcc4fb 100644 --- a/quantum/keymap_extras/keymap_us_international.h +++ b/quantum/keymap_extras/keymap_us_international.h @@ -26,7 +26,7 @@ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ * │     │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │  \  │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │      │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │        │ + * │      │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ´ │        │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ * │        │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │          │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ @@ -34,7 +34,7 @@ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 -#define US_GRV KC_GRV // ` (dead) +#define US_DGRV KC_GRV // ` (dead) #define US_1 KC_1 // 1 #define US_2 KC_2 // 2 #define US_3 KC_3 // 3 @@ -72,7 +72,7 @@ #define US_K KC_K // K #define US_L KC_L // L #define US_SCLN KC_SCLN // ; -#define US_QUOT KC_QUOT // ' (dead) +#define US_ACUT KC_QUOT // ´ (dead) // Row 4 #define US_Z KC_Z // Z #define US_X KC_X // X @@ -91,7 +91,7 @@ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ * │     │   │   │   │   │   │   │   │   │   │   │ { │ } │  |  │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ - * │      │   │   │   │   │   │   │   │   │   │ : │ " │        │ + * │      │   │   │   │   │   │   │   │   │   │ : │ ¨ │        │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ * │        │   │   │   │   │   │   │   │ < │ > │ ? │          │ * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ @@ -99,13 +99,13 @@ * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ */ // Row 1 -#define US_TILD S(US_GRV) // ~ (dead) +#define US_DTIL S(US_DGRV) // ~ (dead) #define US_EXLM S(US_1) // ! -#define US_AT S(US_2) // " +#define US_AT S(US_2) // @ #define US_HASH S(US_3) // # #define US_DLR S(US_4) // $ #define US_PERC S(US_5) // % -#define US_CIRC S(US_6) // ^ +#define US_DCIR S(US_6) // ^ (dead) #define US_AMPR S(US_7) // & #define US_ASTR S(US_8) // * #define US_LPRN S(US_9) // ( @@ -118,7 +118,7 @@ #define US_PIPE S(US_BSLS) // | // Row 3 #define US_COLN S(US_SCLN) // : -#define US_DQUO S(US_QUOT) // " (dead) +#define US_DIAE S(US_ACUT) // ¨ (dead) // Row 4 #define US_LABK S(US_COMM) // < #define US_RABK S(US_DOT) // > @@ -170,7 +170,7 @@ #define US_ETH ALGR(US_D) // Ð #define US_OSTR ALGR(US_L) // Ø #define US_PILC ALGR(US_SCLN) // ¶ -#define US_ACUT ALGR(US_QUOT) // ´ +#define US_NDAC ALGR(US_ACUT) // ´ // Row 4 #define US_AE ALGR(US_Z) // Æ #define US_COPY ALGR(US_C) // © @@ -201,6 +201,6 @@ // Row 3 #define US_SECT S(ALGR(US_S)) // § #define US_DEG S(ALGR(US_SCLN)) // ° -#define US_DIAE S(ALGR(US_QUOT)) // ¨ +#define US_NDDR S(ALGR(US_ACUT)) // ¨ // Row 4 #define US_CENT S(ALGR(US_C)) // ¢ diff --git a/quantum/keymap_extras/keymap_us_international_linux.h b/quantum/keymap_extras/keymap_us_international_linux.h new file mode 100644 index 000000000..2c3e23039 --- /dev/null +++ b/quantum/keymap_extras/keymap_us_international_linux.h @@ -0,0 +1,224 @@ +/* Copyright 2020 + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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 . + */ + +#pragma once + +#include "keymap.h" + +// clang-format off + +/* + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │       │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │     │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │  \  │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │      │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ´ │        │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │        │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │          │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │    │    │    │                        │    │    │    │    │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ +// Row 1 +#define US_DGRV KC_GRV // ` (dead) +#define US_1 KC_1 // 1 +#define US_2 KC_2 // 2 +#define US_3 KC_3 // 3 +#define US_4 KC_4 // 4 +#define US_5 KC_5 // 5 +#define US_6 KC_6 // 6 +#define US_7 KC_7 // 7 +#define US_8 KC_8 // 8 +#define US_9 KC_9 // 9 +#define US_0 KC_0 // 0 +#define US_MINS KC_MINS // - +#define US_EQL KC_EQL // = +// Row 2 +#define US_Q KC_Q // Q +#define US_W KC_W // W +#define US_E KC_E // E +#define US_R KC_R // R +#define US_T KC_T // T +#define US_Y KC_Y // Y +#define US_U KC_U // U +#define US_I KC_I // I +#define US_O KC_O // O +#define US_P KC_P // P +#define US_LBRC KC_LBRC // [ +#define US_RBRC KC_RBRC // ] +#define US_BSLS KC_BSLS // (backslash) +// Row 3 +#define US_A KC_A // A +#define US_S KC_S // S +#define US_D KC_D // D +#define US_F KC_F // F +#define US_G KC_G // G +#define US_H KC_H // H +#define US_J KC_J // J +#define US_K KC_K // K +#define US_L KC_L // L +#define US_SCLN KC_SCLN // ; +#define US_ACUT KC_QUOT // ´ (dead) +// Row 4 +#define US_Z KC_Z // Z +#define US_X KC_X // X +#define US_C KC_C // C +#define US_V KC_V // V +#define US_B KC_B // B +#define US_N KC_N // N +#define US_M KC_M // M +#define US_COMM KC_COMM // , +#define US_DOT KC_DOT // . +#define US_SLSH KC_SLSH // / + +/* Shifted symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │       │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │     │   │   │   │   │   │   │   │   │   │   │ { │ } │  |  │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │      │   │   │   │   │   │   │   │   │   │ : │ ¨ │        │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │        │   │   │   │   │   │   │   │ < │ > │ ? │          │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │    │    │    │                        │    │    │    │    │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ +// Row 1 +#define US_DTIL S(US_DGRV) // ~ (dead) +#define US_EXLM S(US_1) // ! +#define US_AT S(US_2) // @ +#define US_HASH S(US_3) // # +#define US_DLR S(US_4) // $ +#define US_PERC S(US_5) // % +#define US_DCIR S(US_6) // ^ (dead) +#define US_AMPR S(US_7) // & +#define US_ASTR S(US_8) // * +#define US_LPRN S(US_9) // ( +#define US_RPRN S(US_0) // ) +#define US_UNDS S(US_MINS) // _ +#define US_PLUS S(US_EQL) // + +// Row 2 +#define US_LCBR S(US_LBRC) // { +#define US_RCBR S(US_RBRC) // } +#define US_PIPE S(US_BSLS) // | +// Row 3 +#define US_COLN S(US_SCLN) // : +#define US_DIAE S(US_ACUT) // ¨ (dead) +// Row 4 +#define US_LABK S(US_COMM) // < +#define US_RABK S(US_DOT) // > +#define US_QUES S(US_SLSH) // ? + +/* AltGr symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │ ` │ ¡ │ ² │ ³ │ ¤ │ € │ ¼ │ ½ │ ¾ │ ‘ │ ’ │ ¥ │ × │       │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │     │ Ä │ Å │ É │ ® │ Þ │ Ü │ Ú │ Í │ Ó │ Ö │ « │ » │  ¬  │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │      │ Á │ ß │ Ð │   │   │   │   │ Œ │ Ø │ ¶ │ ' │        │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │        │ Æ │   │ © │   │   │ Ñ │ µ │ Ç │ ˙ │ ¿ │          │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │    │    │    │                        │    │    │    │    │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ + +// Row 1 +#define US_GRV ALGR(US_DGRV) // ` +#define US_IEXL ALGR(US_1) // ¡ +#define US_SUP2 ALGR(US_2) // ² +#define US_SUP3 ALGR(US_3) // ³ +#define US_CURR ALGR(US_4) // ¤ +#define US_EURO ALGR(US_5) // € +#define US_QRTR ALGR(US_6) // ¼ +#define US_HALF ALGR(US_7) // ½ +#define US_TQTR ALGR(US_8) // ¾ +#define US_LSQU ALGR(US_9) // ‘ +#define US_RSQU ALGR(US_0) // ’ +#define US_YEN ALGR(US_MINS) // ¥ +#define US_MUL ALGR(US_EQL) // × +// Row 2 +#define US_ADIA ALGR(US_Q) // Ä +#define US_ARNG ALGR(US_W) // Å +#define US_EACU ALGR(US_E) // É +#define US_REGD ALGR(US_R) // ® +#define US_THRN ALGR(US_T) // Þ +#define US_UDIA ALGR(US_Y) // Ü +#define US_UACU ALGR(US_U) // Ú +#define US_IACU ALGR(US_I) // Í +#define US_OACU ALGR(US_O) // Ó +#define US_ODIA ALGR(US_P) // Ö +#define US_LDAQ ALGR(US_LBRC) // « +#define US_RDAQ ALGR(US_RBRC) // » +#define US_NOT ALGR(US_BSLS) // ¬ +// Row 3 +#define US_AACU ALGR(US_A) // Á +#define US_SS ALGR(US_S) // ß +#define US_ETH ALGR(US_D) // Ð +#define US_OE ALGR(US_K) // Œ +#define US_OSTR ALGR(US_L) // Ø +#define US_PILC ALGR(US_SCLN) // ¶ +#define US_QUOT ALGR(US_ACUT) // ' +// Row 4 +#define US_AE ALGR(US_Z) // Æ +#define US_COPY ALGR(US_C) // © +#define US_NTIL ALGR(US_N) // Ñ +#define US_MICR ALGR(US_M) // µ +#define US_CCED ALGR(US_COMM) // Ç +#define US_DOTA ALGR(US_DOT) // ˙ (dead) +#define US_IQUE ALGR(US_SLSH) // ¿ + +/* Shift+AltGr symbols + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ + * │ ~ │ ¹ │ ˝ │ ¯ │ £ │ ¸ │ ^ │ ̛  │ ˛ │ ˘ │ ° │  ̣ │ ÷ │       │ + * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ + * │     │   │   │   │   │   │   │   │   │   │   │ “ │ ” │  ¦  │ + * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ + * │      │   │ § │   │   │   │   │   │   │   │ ° │ " │        │ + * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ + * │        │   │   │ ¢ │   │   │   │   │   │ ˇ │  ̉ │          │ + * ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ + * │    │    │    │                        │    │    │    │    │ + * └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘ + */ +// Row 1 +#define US_TILD S(ALGR(US_DGRV)) // ~ +#define US_SUP1 S(ALGR(US_1)) // ¹ +#define US_DACU S(ALGR(US_2)) // ˝ (dead) +#define US_MACR S(ALGR(US_3)) // ¯ (dead) +#define US_PND S(ALGR(US_4)) // £ +#define US_CEDL S(ALGR(US_5)) // ¸ (dead) +#define US_CIRC S(ALGR(US_6)) // ^ +#define US_HORN S(ALGR(US_7)) // ̛ (dead) +#define US_OGON S(ALGR(US_8)) // ˛ (dead) +#define US_BREV S(ALGR(US_9)) // ˘ (dead) +#define US_RNGA S(ALGR(US_0)) // ° (dead) +#define US_DOTB S(ALGR(US_MINS)) // ̣ (dead) +#define US_DIV S(ALGR(US_EQL)) // ÷ +// Row 2 +#define US_LDQU S(ALGR(US_LBRC)) // “ +#define US_RDQU S(ALGR(US_LBRC)) // ” +#define US_BRKP S(ALGR(US_BSLS)) // ¦ +// Row 3 +#define US_SECT S(ALGR(US_S)) // § +#define US_DEG S(ALGR(US_SCLN)) // ° +#define US_DQUO S(ALGR(US_ACUT)) // " +// Row 4 +#define US_CENT S(ALGR(US_C)) // ¢ +#define US_CARN S(ALGR(US_DOT)) // ˇ (dead) +#define US_HOKA S(ALGR(US_SLSH)) // ̉ (dead) diff --git a/quantum/keymap_extras/sendstring_us_international.h b/quantum/keymap_extras/sendstring_us_international.h new file mode 100644 index 000000000..53a5891fb --- /dev/null +++ b/quantum/keymap_extras/sendstring_us_international.h @@ -0,0 +1,100 @@ +/* Copyright 2019 Rys Sommefeldt + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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 . + */ + +// Sendstring lookup tables for UK layouts + +#pragma once + +#include "keymap_us_international.h" +#include "quantum.h" + +// clang-format off + +const uint8_t ascii_to_shift_lut[16] PROGMEM = { + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + + KCLUT_ENTRY(0, 1, 1, 1, 1, 1, 1, 0), + KCLUT_ENTRY(1, 1, 1, 1, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 1, 0, 1, 0, 1, 1), + KCLUT_ENTRY(1, 1, 1, 1, 1, 1, 1, 1), + KCLUT_ENTRY(1, 1, 1, 1, 1, 1, 1, 1), + KCLUT_ENTRY(1, 1, 1, 1, 1, 1, 1, 1), + KCLUT_ENTRY(1, 1, 1, 0, 0, 0, 1, 1), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 1, 1, 1, 1, 0), +}; + +__attribute__((weak)) const uint8_t ascii_to_dead_lut[16] PROGMEM = { + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + + KCLUT_ENTRY(0, 0, 1, 0, 0, 0, 0, 1), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 1, 0), + KCLUT_ENTRY(1, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 1, 0), +}; + +const uint8_t ascii_to_keycode_lut[128] PROGMEM = { + // NUL SOH STX ETX EOT ENQ ACK BEL + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + // BS TAB LF VT FF CR SO SI + KC_BSPC, KC_TAB, KC_ENT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + // DLE DC1 DC2 DC3 DC4 NAK SYN ETB + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + // CAN EM SUB ESC FS GS RS US + XXXXXXX, XXXXXXX, XXXXXXX, KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + + // ! " # $ % & ' + KC_SPC, US_1, US_ACUT, US_3, US_4, US_5, US_7, US_ACUT, + // ( ) * + , - . / + US_9, US_0, US_8, US_EQL, US_COMM, US_MINS, US_DOT, US_SLSH, + // 0 1 2 3 4 5 6 7 + US_0, US_1, US_2, US_3, US_4, US_5, US_6, US_7, + // 8 9 : ; < = > ? + US_8, US_9, US_SCLN, US_SCLN, US_COMM, US_EQL, US_DOT, US_SLSH, + // @ A B C D E F G + US_2, US_A, US_B, US_C, US_D, US_E, US_F, US_G, + // H I J K L M N O + US_H, US_I, US_J, US_K, US_L, US_M, US_N, US_O, + // P Q R S T U V W + US_P, US_Q, US_R, US_S, US_T, US_U, US_V, US_W, + // X Y Z [ \ ] ^ _ + US_X, US_Y, US_Z, US_LBRC, US_BSLS, US_RBRC, US_6, US_MINS, + // ` a b c d e f g + US_DGRV, US_A, US_B, US_C, US_D, US_E, US_F, US_G, + // h i j k l m n o + US_H, US_I, US_J, US_K, US_L, US_M, US_N, US_O, + // p q r s t u v w + US_P, US_Q, US_R, US_S, US_T, US_U, US_V, US_W, + // x y z { | } ~ DEL + US_X, US_Y, US_Z, US_LBRC, US_BSLS, US_RBRC, US_DGRV, KC_DEL +}; diff --git a/quantum/quantum.c b/quantum/quantum.c index 3ac0ed871..ece0388d3 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -391,6 +391,29 @@ __attribute__((weak)) const uint8_t ascii_to_altgr_lut[16] PROGMEM = { KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), }; +/* Bit-Packed look-up table to convert an ASCII character to whether + * [Space] needs to be sent after the keycode + */ +__attribute__((weak)) const uint8_t ascii_to_dead_lut[16] PROGMEM = { + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), + KCLUT_ENTRY(0, 0, 0, 0, 0, 0, 0, 0), +}; + /* Look-up table to convert an ASCII character to a keycode. */ __attribute__((weak)) const uint8_t ascii_to_keycode_lut[128] PROGMEM = { @@ -528,9 +551,10 @@ void send_char(char ascii_code) { } #endif - uint8_t keycode = pgm_read_byte(&ascii_to_keycode_lut[(uint8_t)ascii_code]); - bool is_shifted = PGM_LOADBIT(ascii_to_shift_lut, (uint8_t)ascii_code); - bool is_altgred = PGM_LOADBIT(ascii_to_altgr_lut, (uint8_t)ascii_code); + uint8_t keycode = pgm_read_byte(&ascii_to_keycode_lut[(uint8_t)ascii_code]); + bool is_shifted = PGM_LOADBIT(ascii_to_shift_lut, (uint8_t)ascii_code); + bool is_altgred = PGM_LOADBIT(ascii_to_altgr_lut, (uint8_t)ascii_code); + bool is_dead = PGM_LOADBIT(ascii_to_dead_lut, (uint8_t)ascii_code); if (is_shifted) { register_code(KC_LSFT); @@ -545,6 +569,9 @@ void send_char(char ascii_code) { if (is_shifted) { unregister_code(KC_LSFT); } + if (is_dead) { + tap_code(KC_SPACE); + } } void set_single_persistent_default_layer(uint8_t default_layer) { diff --git a/quantum/quantum.h b/quantum/quantum.h index 9b2b9dee6..7e209304b 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -288,6 +288,7 @@ static __inline__ void __interrupt_enable__(const uint8_t *__s) { extern const uint8_t ascii_to_keycode_lut[128]; extern const uint8_t ascii_to_shift_lut[16]; extern const uint8_t ascii_to_altgr_lut[16]; +extern const uint8_t ascii_to_dead_lut[16]; // clang-format off #define KCLUT_ENTRY(a, b, c, d, e, f, g, h) \ ( ((a) ? 1 : 0) << 0 \