[Keymap] Add userspace rverst (#12205)

Co-authored-by: Robert Verst <robert.verst@tobit.com>
This commit is contained in:
Robert Verst 2021-03-17 17:44:21 +01:00 committed by GitHub
parent 8a2d3a8861
commit 3bc7f46412
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 1196 additions and 0 deletions

View file

@ -0,0 +1,80 @@
/* Copyright 2021 Robert Verst <robert@verst.eu> @rverst
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "rverst.h"
//#define CLOSED_CASE // no underglow RGB visible
// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(
KC_ESC , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , MO(4) , KC_DEL ,
KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_MINS, KC_EQL , KC_BSPC, KC_PGUP,
KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P , KC_LBRC, KC_RBRC, KC_BSLS, KC_PGDN,
KC_ESC , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, KC_ENT ,
KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC , OSL(1) , KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT(
RV_SNAP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE,
RV_DEG , RV_SUP1, RV_SUP2, RV_SUP3, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RV_UNEQ, RV_PM , KC_TRNS, KC_VOLU,
KC_TRNS, KC_TRNS, KC_TRNS, RV_EUR , RV_RT , RV_TM , KC_TRNS, RV_UUML, KC_TRNS, RV_OUML, KC_TRNS, KC_TRNS, KC_PEQL, KC_TRNS, KC_VOLD,
KC_CAPS, RV_AUML, RV_SZ , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RV_LOCK, KC_TRNS, KC_PAST, KC_PENT,
KC_TRNS, KC_TRNS, KC_TRNS, RV_CC , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PDOT, KC_PSLS, KC_TRNS, KC_MSTP,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RGUI, KC_MPRV, KC_MPLY, KC_MNXT
),
[2] = LAYOUT(
KC_ESC , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_TRNS, MO(4) , KC_MUTE,
KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_MINS, KC_EQL , KC_BSPC, KC_VOLU,
KC_TAB , KC_Q , KC_W , KC_F , KC_P , KC_G , KC_J , KC_L , KC_U , KC_Y , KC_SCLN, KC_LBRC, KC_RBRC, KC_BSLS, KC_VOLD,
KC_ESC , KC_A , KC_R , KC_S , KC_T , KC_D , KC_H , KC_N , KC_E , KC_I , KC_O , KC_QUOT, KC_ENT,
KC_LSFT, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_K , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LALT, KC_LGUI, KC_SPC , OSL(3) , KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
),
[3] = LAYOUT(
RV_SNAP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MUTE,
RV_DEG , RV_SUP1, RV_SUP2, RV_SUP3, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RV_UNEQ, RV_PM , KC_TRNS, KC_VOLU,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RV_LOCK, RV_UUML, KC_TRNS, KC_TRNS, KC_TRNS, KC_PEQL, KC_TRNS, KC_VOLD,
KC_CAPS, RV_AUML, RV_RT , RV_SZ , RV_TM , KC_TRNS, KC_TRNS, KC_TRNS, RV_EUR , KC_TRNS, RV_OUML, KC_PAST, KC_PENT,
KC_TRNS, KC_TRNS, KC_TRNS, RV_CC , KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PDOT, KC_PSLS, KC_TRNS, KC_MSTP,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RGUI, KC_MPRV, KC_MPLY, KC_MNXT
),
[4] = LAYOUT(
EEP_RST, RV_SM0 , RV_SM1 , RV_SM2 , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , DF(0) , DF(2) , KC_TRNS, MO(5) ,
RV_SAYM, RV_SM3 , RV_SM4 , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ,
KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ,
KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ,
KC_TRNS, RGB_HUI, RGB_SAI, RGB_VAI, KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , RGB_TOG,
KC_NO , KC_NO , GUI_ON , KC_NO , KC_NO , RCG_SWP, RGB_RMOD,RGB_M_P, RGB_MOD
),
[5] = LAYOUT(
RESET , RV_SM0S, RV_SM1S, RV_SM2S, KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_TRNS,
KC_NO , RV_SM3S, RV_SM4S, KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ,
KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ,
KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ,
KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO , KC_NO ,
KC_NO , KC_NO , GUI_OFF, KC_NO , KC_NO , RCG_NRM, KC_NO , KC_NO , KC_NO
)
};
// clang-format on
void keyboard_post_init_keymap(void) {
#ifdef CLOSED_CASE
if (rgblight_is_enabled()) {
rgblight_disable();
}
#endif
}

View file

@ -0,0 +1,23 @@
# idobao id80
This is my layout for the idobao id80. It depends of my [user files](../../../../users/rverst)
and the main goal is to give an convenient and unified access to some special keys
(umlauts, ß, €) for different operating systems (Mac, Windows and Linux).
## Overview
- Layer 0 is the base US-ANSI layout with Mac-style system keys and a OSL-Key for Layer 1 right of the space bar.
- Layer 1 has the special keys and some media-functions like mute, volume up/down etc.
- Layer 2 and 3 are basically the same as Layer 0 and 1 but in Colemak-Layout
- Layer 4 and 5 has some functions like switching the keyboard mode, switching the default layer etc.
## Keyboard modes
- *F1:* Mac Unicode mode (use 'Unicode Hex Input' as input source)
- *F2:* Windows Unicode mode (use [WinCompse](https://github.com/SamHocevar/wincompose) software)
- *F3:* Linux Unicode mode (not tested yet but should work out of the box)
- *1:* Mac legacy mode (uses option-sequences, e.g. `<option>+u a` for an `ä`), if I'm not able to set the input source
- *2:* Windows legacy mode (uses altgr-sequences e.g. `<altgr>+0228` for an `ä`, if I'm not able to use WinCompose)
Layer 4 to switch the modes temporary, layer 5 to switch and save to eeprom.

View file

@ -0,0 +1,499 @@
{
"keyboard": "id80",
"keymap": "rverst",
"layout": "LAYOUT",
"layers": [
[
"KC_ESC",
"KC_F1",
"KC_F2",
"KC_F3",
"KC_F4",
"KC_F5",
"KC_F6",
"KC_F7",
"KC_F8",
"KC_F9",
"KC_F10",
"KC_F11",
"KC_F12",
"MO(4)",
"KC_DEL",
"KC_GRV",
"KC_1",
"KC_2",
"KC_3",
"KC_4",
"KC_5",
"KC_6",
"KC_7",
"KC_8",
"KC_9",
"KC_0",
"KC_MINS",
"KC_EQL",
"KC_BSPC",
"KC_PGUP",
"KC_TAB",
"KC_Q",
"KC_W",
"KC_E",
"KC_R",
"KC_T",
"KC_Y",
"KC_U",
"KC_I",
"KC_O",
"KC_P",
"KC_LBRC",
"KC_RBRC",
"KC_BSLS",
"KC_PGDN",
"KC_ESC",
"KC_A",
"KC_S",
"KC_D",
"KC_F",
"KC_G",
"KC_H",
"KC_J",
"KC_K",
"KC_L",
"KC_SCLN",
"KC_QUOT",
"KC_ENT",
"KC_LSFT",
"KC_Z",
"KC_X",
"KC_C",
"KC_V",
"KC_B",
"KC_N",
"KC_M",
"KC_COMM",
"KC_DOT",
"KC_SLSH",
"KC_RSFT",
"KC_UP",
"KC_LCTL",
"KC_LALT",
"KC_LGUI",
"KC_SPC",
"OSL(1)",
"KC_RCTL",
"KC_LEFT",
"KC_DOWN",
"KC_RGHT"
],
[
"RV_SNAP",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_MUTE",
"RV_DEG",
"RV_SUP1",
"RV_SUP2",
"RV_SUP3",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"RV_UNEQ",
"RV_PM",
"KC_TRNS",
"KC_VOLU",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"RV_EUR",
"RV_RT",
"RV_TM",
"KC_TRNS",
"RV_UUML",
"KC_TRNS",
"RV_OUML",
"KC_TRNS",
"KC_TRNS",
"KC_PEQL",
"KC_TRNS",
"KC_VOLD",
"KC_CAPS",
"RV_AUML",
"RV_SZ",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"RV_LOCK",
"KC_TRNS",
"KC_PAST",
"KC_PENT",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"RV_CC",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_PDOT",
"KC_PSLS",
"KC_TRNS",
"KC_MSTP",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_RGUI",
"KC_MPRV",
"KC_MPLY",
"KC_MNXT"
],
[
"KC_ESC",
"KC_F1",
"KC_F2",
"KC_F3",
"KC_F4",
"KC_F5",
"KC_F6",
"KC_F7",
"KC_F8",
"KC_F9",
"KC_F10",
"KC_F11",
"KC_TRNS",
"MO(4)",
"KC_MUTE",
"KC_GRV",
"KC_1",
"KC_2",
"KC_3",
"KC_4",
"KC_5",
"KC_6",
"KC_7",
"KC_8",
"KC_9",
"KC_0",
"KC_MINS",
"KC_EQL",
"KC_BSPC",
"KC_VOLU",
"KC_TAB",
"KC_Q",
"KC_W",
"KC_F",
"KC_P",
"KC_G",
"KC_J",
"KC_L",
"KC_U",
"KC_Y",
"KC_SCLN",
"KC_LBRC",
"KC_RBRC",
"KC_BSLS",
"KC_VOLD",
"KC_ESC",
"KC_A",
"KC_R",
"KC_S",
"KC_T",
"KC_D",
"KC_H",
"KC_N",
"KC_E",
"KC_I",
"KC_O",
"KC_QUOT",
"KC_ENT",
"KC_LSFT",
"KC_Z",
"KC_X",
"KC_C",
"KC_V",
"KC_B",
"KC_K",
"KC_M",
"KC_COMM",
"KC_DOT",
"KC_SLSH",
"KC_RSFT",
"KC_UP",
"KC_LCTL",
"KC_LALT",
"KC_LGUI",
"KC_SPC",
"OSL(3)",
"KC_RCTL",
"KC_LEFT",
"KC_DOWN",
"KC_RGHT"
],
[
"RV_SNAP",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_MUTE",
"RV_DEG",
"RV_SUP1",
"RV_SUP2",
"RV_SUP3",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"RV_UNEQ",
"RV_PM",
"KC_TRNS",
"KC_VOLU",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"RV_LOCK",
"RV_UUML",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_PEQL",
"KC_TRNS",
"KC_VOLD",
"KC_CAPS",
"RV_AUML",
"RV_RT",
"RV_SZ",
"RV_TM",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"RV_EUR",
"KC_TRNS",
"RV_OUML",
"KC_PAST",
"KC_PENT",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"RV_CC",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_PDOT",
"KC_PSLS",
"KC_TRNS",
"KC_MSTP",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_TRNS",
"KC_RGUI",
"KC_MPRV",
"KC_MPLY",
"KC_MNXT"
],
[
"EEP_RST",
"RV_SM0",
"RV_SM1",
"RV_SM2",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"DF(0)",
"DF(2)",
"KC_TRNS",
"MO(5)",
"RV_SAYM",
"RV_SM3",
"RV_SM4",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_TRNS",
"RGB_HUI",
"RGB_SAI",
"RGB_VAI",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"RGB_TOG",
"KC_NO",
"KC_NO",
"GUI_ON",
"KC_NO",
"KC_NO",
"RCG_SWP",
"RGB_RMOD",
"RGB_M_P",
"RGB_MOD"
],
[
"RESET",
"RV_SM0S",
"RV_SM1S",
"RV_SM2S",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_TRNS",
"KC_NO",
"RV_SM3S",
"RV_SM4S",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"KC_NO",
"GUI_OFF",
"KC_NO",
"KC_NO",
"RCG_NRM",
"KC_NO",
"KC_NO",
"KC_NO"
]
]
}

38
users/rverst/config.h Normal file
View file

@ -0,0 +1,38 @@
/* Copyright 2021 Robert Verst <robert@verst.eu> @rverst
*
* 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifdef RGBLIGHT_ENABLE
# define RGBLIGHT_SLEEP
# ifdef RGBLIGHT_ANIMATIONS
# undef RGBLIGHT_ANIMATIONS
# endif
# define RGBLIGHT_SLEEP
# define RGBLIGHT_EFFECT_BREATHING
# define RGBLIGHT_EFFECT_RAINBOW_MOOD
# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
# define RGBLIGHT_EFFECT_STATIC_GRADIENT
# define RGBLIGHT_EFFECT_TWINKLE
#endif // RGBLIGHT_ENABLE
#if defined(LOCKING_SUPPORT_ENABLE)
# undef LOCKING_SUPPORT_ENABLE
#endif
#if defined(LOCKING_RESYNC_ENABLE)
# undef LOCKING_RESYNC_ENABLE
#endif

18
users/rverst/readme.md Normal file
View file

@ -0,0 +1,18 @@
# Overview
This is my user space, main goal is to unify the experience between different
keyboard models and operating systems.
My native language is German and I almost exclusively use keyboards in the
US-ANSI layout. I find this layout the most practical for programming as
far as the placement of special characters is concerned. However, when I write
in German, I miss a few special characters like umlauts, etc.
Since I also use different operating systems (MacOS, Linux and Windows)
and especially Windows and MacOS behave very differently regarding the input
of such characters (under Linux there is at least the Compose key).
So I needed a hardware solution, and that's how I came to QMK.
Here are defined some key codes to put the keyboard in different modes
(Mac, Windows, Linux) and the corresponding functions to make the input.
And some logic to store the respective mode and load it at boot time.
You'll find a proper layout here: [keyborads/id80/keymaps/rverst](../../keyboards/id80/keymaps/rverst)

7
users/rverst/rules.mk Normal file
View file

@ -0,0 +1,7 @@
SRC += rverst.c
LEADER_ENABLE = no
MOUSEKEY_ENABLE = no
LTO_ENABLE = yes
CONSOLE_ENABLE = yes
UNICODEMAP_ENABLE = yes

419
users/rverst/rverst.c Normal file
View file

@ -0,0 +1,419 @@
/* Copyright 2021 Robert Verst <robert@verst.eu> @rverst
*
* 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 <http://www.gnu.org/licenses/>.
*/
#include "rverst.h"
#include "print.h"
#ifdef UNICODEMAP_ENABLE
# include "unicode.h"
#endif
userspace_config_t userspace_config;
uint8_t get_mode(void) {
int m = 0;
if (userspace_config.mode_1) {
m += 1;
}
if (userspace_config.mode_2) {
m += 2;
}
if (userspace_config.mode_3) {
m += 4;
}
return m;
}
void set_mode(uint8_t mode, bool save) {
if (mode == get_mode()) {
return;
}
switch_mode(mode);
if (mode > 7) {
mode = 7;
}
if (mode >= 4) {
userspace_config.mode_3 = true;
mode -= 4;
} else {
userspace_config.mode_3 = false;
}
if (mode >= 2) {
userspace_config.mode_2 = true;
mode -= 2;
} else {
userspace_config.mode_2 = false;
}
if (mode > 0) {
userspace_config.mode_1 = true;
} else {
userspace_config.mode_1 = false;
}
if (save) {
eeconfig_update_user(userspace_config.raw);
}
}
void switch_mode(uint8_t mode) {
#ifdef UNICODEMAP_ENABLE
switch (mode) {
case MAC_UNI:
set_unicode_input_mode(UC_MAC);
break;
case WINDOWS_UNI:
set_unicode_input_mode(UC_WINC);
break;
case LINUX_UNI:
set_unicode_input_mode(UC_LNX);
break;
}
#endif
}
bool is_unicode(uint8_t mode) { return (mode == MAC_UNI) || (mode == WINDOWS_UNI) || (mode == LINUX_UNI); }
//**********************
// keyboard_pre_init
//**********************
__attribute__((weak)) void keyboard_pre_init_keymap(void) {}
void keyboard_pre_init_user(void) {
userspace_config.raw = eeconfig_read_user();
switch_mode(get_mode());
keyboard_pre_init_keymap();
}
//************************
// keyboard_post_init
//************************
__attribute__((weak)) void keyboard_post_init_keymap(void) {}
void keyboard_post_init_user(void) {
// debug_enable = true;
// debug_matrix=true;
// debug_keyboard = true;
#ifdef RGBLIGHT_ENABLE
#endif
keyboard_post_init_keymap();
}
//**********************
// eeconfig_init
//**********************
__attribute__((weak)) void eeconfig_init_keymap(void) {}
void eeconfig_init_user(void) {
userspace_config.raw = 0;
eeconfig_update_user(userspace_config.raw);
eeconfig_init_keymap();
keyboard_init();
}
//**********************
// process_record
//**********************
__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (process_record_keymap(keycode, record)) {
return false;
}
bool ls = (get_mods() | get_weak_mods()) & MOD_BIT(KC_LSFT);
bool rs = (get_mods() | get_weak_mods()) & MOD_BIT(KC_RSFT);
bool as = ls || rs;
int mode = get_mode();
switch (keycode) {
case RV_SM0:
case RV_SM0S:
set_mode(MAC_UNI, keycode == RV_SM0S);
return false;
case RV_SM1:
case RV_SM1S:
set_mode(WINDOWS_UNI, keycode == RV_SM1S);
return false;
case RV_SM2:
case RV_SM2S:
set_mode(LINUX_UNI, keycode == RV_SM2S);
return false;
case RV_SM3:
case RV_SM3S:
set_mode(MAC, keycode == RV_SM3S);
return false;
case RV_SM4:
case RV_SM4S:
set_mode(WINDOWS, keycode == RV_SM4S);
return false;
case RV_SAYM:
switch (mode) {
case MAC:
send_string("MacOS (normal)");
break;
case WINDOWS:
send_string("Windows (normal)");
break;
case MAC_UNI:
send_string("MacOS (unicode)");
break;
case WINDOWS_UNI:
send_string("Windows (unicode)");
break;
case LINUX_UNI:
send_string("Linux (unicode)");
break;
}
return false;
// Lock computer
case RV_LOCK:
if (mode == MAC || mode == MAC_UNI) {
register_code(KC_LGUI);
register_code(KC_LCTL);
tap_code(KC_Q);
unregister_code(KC_LCTL);
unregister_code(KC_LGUI);
} else if (mode == WINDOWS || mode == WINDOWS_UNI) {
register_code(KC_LGUI);
tap_code(KC_L);
register_code(KC_LGUI);
}
return false;
// Screenshot
case RV_SNAP:
if (mode == MAC || mode == MAC_UNI) {
if (ls) unregister_code(KC_LSFT);
if (rs) unregister_code(KC_RSFT);
register_code(KC_LGUI);
register_code(KC_LSFT);
if (as)
tap_code(KC_5);
else
tap_code(KC_4);
unregister_code(KC_LSFT);
unregister_code(KC_LGUI);
if (ls) register_code(KC_LSFT);
if (rs) register_code(KC_RSFT);
} else if (mode == WINDOWS || mode == WINDOWS_UNI) {
register_code(KC_LGUI);
register_code(KC_LSFT);
tap_code(KC_S);
register_code(KC_LSFT);
register_code(KC_LGUI);
}
return false;
// Umlauts - äÄöÖüÜ
case RV_AUML:
case RV_OUML:
case RV_UUML:
if (is_unicode(mode)) {
if (keycode == RV_AUML) {
if (as)
send_unicode_string("Ä");
else
send_unicode_string("ä");
} else if (keycode == RV_OUML) {
if (as)
send_unicode_string("Ö");
else
send_unicode_string("ö");
} else if (keycode == RV_UUML) {
if (as)
send_unicode_string("Ü");
else
send_unicode_string("ü");
}
} else if (mode == MAC) {
if (ls) unregister_code(KC_LSFT);
if (rs) unregister_code(KC_RSFT);
register_code(KC_LALT);
tap_code(KC_U);
unregister_code(KC_LALT);
if (as) register_code(KC_LSFT);
if (keycode == RV_AUML) {
tap_code(KC_A);
} else if (keycode == RV_OUML) {
tap_code(KC_O);
} else if (keycode == RV_UUML) {
tap_code(KC_U);
}
if (rs) {
unregister_code(KC_LSFT);
register_code(KC_RSFT);
}
} else if (mode == WINDOWS) {
if (ls) unregister_code(KC_LSFT);
if (rs) unregister_code(KC_RSFT);
register_code(KC_RALT);
tap_code(KC_1);
if (keycode == RV_AUML) {
if (as)
tap_code(KC_4);
else
tap_code(KC_3);
tap_code(KC_2);
} else if (keycode == RV_OUML) {
if (as) {
tap_code(KC_5);
tap_code(KC_3);
} else {
tap_code(KC_4);
tap_code(KC_8);
}
} else if (keycode == RV_UUML) {
if (as) {
tap_code(KC_5);
tap_code(KC_4);
} else {
tap_code(KC_2);
tap_code(KC_9);
}
}
unregister_code(KC_RALT);
if (ls) register_code(KC_LSFT);
if (rs) register_code(KC_RSFT);
}
return false;
// Euro sign - €
// with legacy-mode for MAC and WINDOWS without unicode support
case RV_EUR:
if (is_unicode(mode)) {
send_unicode_string("");
} else if (mode == MAC) {
register_code(KC_LALT);
register_code(KC_LSFT);
tap_code(KC_2);
unregister_code(KC_LSFT);
unregister_code(KC_LALT);
} else if (mode == WINDOWS) {
register_code(KC_RALT);
tap_code(KC_0);
tap_code(KC_1);
tap_code(KC_2);
tap_code(KC_8);
unregister_code(KC_RALT);
}
return false;
// Sharp-S - ß
// with legacy-mode for MAC and WINDOWS without unicode support
case RV_SZ:
if (is_unicode(mode)) {
if (as) {
send_unicode_string("§");
} else {
send_unicode_string("ß");
}
} else if (mode == MAC) {
register_code(KC_LALT);
tap_code(KC_S);
unregister_code(KC_LALT);
} else if (mode == WINDOWS) {
register_code(KC_RALT);
tap_code(KC_2);
tap_code(KC_2);
tap_code(KC_5);
unregister_code(KC_RALT);
}
return false;
// Trademark - ™
case RV_TM:
if (is_unicode(mode)) {
send_unicode_string("");
}
return false;
// Registered trademark - ®
case RV_RT:
if (is_unicode(mode)) {
send_unicode_string("®");
}
return false;
// Copyright - ©
case RV_CC:
if (is_unicode(mode)) {
send_unicode_string("©");
}
return false;
// Degree - °
case RV_DEG:
if (is_unicode(mode)) {
send_unicode_string("°");
}
return false;
// Plus-minus - ±
case RV_PM:
if (is_unicode(mode)) {
send_unicode_string("±");
}
return false;
// Not equal - ≠
case RV_UNEQ:
if (is_unicode(mode)) {
send_unicode_string("");
}
return false;
// Superscript one - ¹
case RV_SUP1:
if (is_unicode(mode)) {
send_unicode_string("¹");
}
return false;
// Superscript two - ²
case RV_SUP2:
if (is_unicode(mode)) {
send_unicode_string("²");
}
return false;
// Superscript three - ³
case RV_SUP3:
if (is_unicode(mode)) {
send_unicode_string("³");
}
return false;
}
return true;
}

81
users/rverst/rverst.h Normal file
View file

@ -0,0 +1,81 @@
/* Copyright 2021 Robert Verst <robert@verst.eu> @rverst
*
* 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include QMK_KEYBOARD_H
enum userspace_mode {
MAC = 0,
WINDOWS,
MAC_UNI,
WINDOWS_UNI,
LINUX_UNI,
};
enum userspace_keycodes {
RV_NON = SAFE_RANGE,
RV_SM0, // set Mac Unicode mode
RV_SM1, // set Window Unicode mode
RV_SM2, // set Linux Unicode mode
RV_SM3, // set Mac lagecy mode
RV_SM4, // set Windows legacy mode
RV_SM0S, // set Mac Unicode mode and save
RV_SM1S, // set Windows Unicode mode and save
RV_SM2S, // set Linux Unicode and save
RV_SM3S, // set Mac legacy mode
RV_SM4S, // set Windows legacy and save
RV_SAYM, // say mode
RV_LOCK, // lock computer
RV_AUML, // äÄ
RV_OUML, // öÖ
RV_UUML, // üÜ
RV_EUR, // €
RV_SZ, // ߧ
RV_TM, // ™
RV_RT, // ®
RV_CC, // ©
RV_DEG, // °
RV_SNAP, // Screenshot
RV_PM, // ±
RV_UNEQ, // ≠
RV_SUP1, // ¹
RV_SUP2, // ²
RV_SUP3, // ³
};
typedef union {
uint32_t raw;
struct {
bool mode_1 : 1;
bool mode_2 : 1;
bool mode_3 : 1;
};
} userspace_config_t;
extern userspace_config_t userspace_config;
uint8_t get_mode(void);
void set_mode(uint8_t mode, bool save);
void switch_mode(uint8_t mode);
bool is_unicode(uint8_t mode);
void keyboard_pre_init_keymap(void);
void keyboard_post_init_keymap(void);
void eeconfig_init_keymap(void);
bool process_record_keymap(uint16_t keycode, keyrecord_t *record);

31
users/rverst/unicode.h Normal file
View file

@ -0,0 +1,31 @@
/* Copyright 2021 Robert Verst <robert@verst.eu> @rverst
*
* 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#ifdef UNICODE_SELECTED_MODES
# undef UNICODE_SELECTED_MODES
# define UNICODE_SELECTED_MODES UC_MAC, UC_LNX, UC_WINC
#endif
enum unicode_names { BANG, IRONY, SNEK };
const uint32_t PROGMEM unicode_map[] = {
[BANG] = 0x203D,
[IRONY] = 0x2E2E,
[SNEK] = 0x1F40D,
};