From b6ca21c65c0d32241ed697072292bd5118b64f9a Mon Sep 17 00:00:00 2001 From: jonavin <71780717+Jonavin@users.noreply.github.com> Date: Wed, 1 Sep 2021 23:42:31 -0400 Subject: [PATCH] [Keymap] Jonavin keymap gmmk pro (#14220) add rgb nightmode and optional colemak layer Co-authored-by: Jonavin <=> --- .../gmmk/pro/ansi/keymaps/jonavin/config.h | 6 +++++ .../gmmk/pro/ansi/keymaps/jonavin/keymap.c | 22 ++++++++++++++++- .../gmmk/pro/ansi/keymaps/jonavin/readme.md | 14 ++++++++--- .../gmmk/pro/ansi/keymaps/jonavin/rules.mk | 2 ++ users/jonavin/jonavin.c | 24 ++++++++++++++++++- users/jonavin/jonavin.h | 5 +++- users/jonavin/rules.mk | 3 +++ 7 files changed, 70 insertions(+), 6 deletions(-) diff --git a/keyboards/gmmk/pro/ansi/keymaps/jonavin/config.h b/keyboards/gmmk/pro/ansi/keymaps/jonavin/config.h index e4ae4c9446a..ed78f99eca3 100644 --- a/keyboards/gmmk/pro/ansi/keymaps/jonavin/config.h +++ b/keyboards/gmmk/pro/ansi/keymaps/jonavin/config.h @@ -31,3 +31,9 @@ #define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_SOLID_COLOR #define RGB_DISABLE_WHEN_USB_SUSPENDED #endif + +// add fifth layer for colemak -- set "COLEMAK_LAYER_ENABLE = yes" in rules.mk to enable +#if defined COLEMAK_LAYER_ENABLE + #define DYNAMIC_KEYMAP_LAYER_COUNT 5 + #define _COLEMAK 4 +#endif // COLEMAK_LAYER_ENABLE diff --git a/keyboards/gmmk/pro/ansi/keymaps/jonavin/keymap.c b/keyboards/gmmk/pro/ansi/keymaps/jonavin/keymap.c index edca78cd179..20a786feb7e 100644 --- a/keyboards/gmmk/pro/ansi/keymaps/jonavin/keymap.c +++ b/keyboards/gmmk/pro/ansi/keymaps/jonavin/keymap.c @@ -44,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RGB_TOG, _______, _______, RGB_VAI, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, _______, _______, _______, RESET, KC_HOME, KC_CAPS, _______, RGB_VAD, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_END, - _______, _______, RGB_HUI, _______, _______, _______, KC_NLCK, _______, RGB_TOD, RGB_TOI, _______, _______, RGB_MOD, _______, + _______, RGB_NITE,RGB_HUI, _______, _______, _______, KC_NLCK, _______, RGB_TOD, RGB_TOI, _______, _______, RGB_MOD, _______, _______, KC_WINLCK, _______, _______, _______, _______, _______, RGB_SPD, RGB_RMOD, RGB_SPI ), @@ -66,12 +66,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ), +#ifdef COLEMAK_LAYER_ENABLE + [_COLEMAK] = 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, KC_INS, 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_DEL, + 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_PGUP, + TT(_LOWER), 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_PGDN, + KC_LSFTCAPSWIN, 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_END, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FN1),KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT + ), +#endif // COLEMAK_LAYER_ENABLE }; #ifdef RGB_MATRIX_ENABLE // Capslock, Scroll lock and Numlock indicator on Left side lights. void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + if (get_rgb_nightmode()) rgb_matrix_set_color_all(RGB_OFF); if (IS_HOST_LED_ON(USB_LED_SCROLL_LOCK)) { rgb_matrix_set_color(LED_L1, RGB_GREEN); rgb_matrix_set_color(LED_L2, RGB_GREEN); @@ -120,6 +131,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { rgb_matrix_set_color(LED_R7, RGB_GREEN); rgb_matrix_set_color(LED_R8, RGB_GREEN); break; +#ifdef COLEMAK_LAYER_ENABLE + case _COLEMAK: + for (uint8_t i=0; i or encoder - setting to zero disables timeout - indicators in FN layer using RGB in FN and number rows to show the timeout in minutes - - LED address location map as enum definition + - LED address location map as enum definition in rgb_matrix_map.h - LED group lists for arrows, numpad, F row, num row, left and right side LEDs - - default startuo in single mode with default colour + - default startup in single mode with default colour - Capslock, Scroll Lock, and Num Lock (not set) indicator on left side LED - Layer indicator on right side LED - Fn key light up red when Fn layer activate - Win Key light up red when Win Lock mode enabled - Layer 2 activation lights up Numpad area + - Fn + Z to turn off all RGB lights except rgb indicators; press again to toggle rules.mk OPTIONS - Active features from userspace STARTUP_NUMLOCK_ON = yes @@ -42,12 +43,19 @@ TD_LSFT_CAPSLOCK_ENABLE = yes IDLE_TIMEOUT_ENABLE = yes - Enables Timer functionality; for RGB idle timeouts that can be changed dynamically +COLEMAK_LAYER_ENABLE = yes + - Enabled optional 5th layer for COLEMAK layout + - Use Shift and encoder to enter 5th layer, right led indicator lights up BLUE + ## All layers diagram Default layer ![image](https://user-images.githubusercontent.com/71780717/124177658-82324880-da7e-11eb-9421-b69100131062.png) Fn Layer -![image](https://user-images.githubusercontent.com/71780717/126086069-bc539ffc-3ab6-4ebb-9bef-5005f8add294.png) +![image](https://user-images.githubusercontent.com/71780717/131255937-06c9691b-835f-4c94-93e6-6d1dc3de272b.png) Layer 2 (Caps Lock Mod) ![image](https://user-images.githubusercontent.com/71780717/124177683-8b231a00-da7e-11eb-9434-e2475f679a54.png) + +Optional COLEMAK layer +![image](https://user-images.githubusercontent.com/71780717/131235050-980d2f54-2d23-4ae8-a83f-9fcdbe60d6cb.png) diff --git a/keyboards/gmmk/pro/ansi/keymaps/jonavin/rules.mk b/keyboards/gmmk/pro/ansi/keymaps/jonavin/rules.mk index 6d3574e7f5d..b06ae1b6ad5 100644 --- a/keyboards/gmmk/pro/ansi/keymaps/jonavin/rules.mk +++ b/keyboards/gmmk/pro/ansi/keymaps/jonavin/rules.mk @@ -7,3 +7,5 @@ TD_LSFT_CAPSLOCK_ENABLE = yes IDLE_TIMEOUT_ENABLE = yes STARTUP_NUMLOCK_ON = yes ENCODER_DEFAULTACTIONS_ENABLE = yes + +COLEMAK_LAYER_ENABLE = yes #Enable Colemak layer / set to no to disable diff --git a/users/jonavin/jonavin.c b/users/jonavin/jonavin.c index d5fdb2a1ebf..bd6c55e9fed 100644 --- a/users/jonavin/jonavin.c +++ b/users/jonavin/jonavin.c @@ -45,6 +45,22 @@ along with this program. If not, see . }; #endif // TD_LSFT_CAPSLOCK_ENABLE +// RGB NIGHT MODE +#ifdef RGB_MATRIX_ENABLE + static bool rgb_nightmode = false; + + // Turn on/off NUM LOCK if current state is different + void activate_rgb_nightmode (bool turn_on) { + if (rgb_nightmode != turn_on) { + rgb_nightmode = !rgb_nightmode; + } + } + + bool get_rgb_nightmode(void) { + return rgb_nightmode; + } +#endif // RGB_MATRIX_ENABLE + // TIMEOUTS #ifdef IDLE_TIMEOUT_ENABLE static uint16_t timeout_timer = 0; @@ -192,7 +208,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } else unregister_code16(keycode); break; #endif // IDLE_TIMEOUT_ENABLE - +#ifdef RGB_MATRIX_ENABLE + case RGB_NITE: + if(record->event.pressed) { + rgb_nightmode = !rgb_nightmode; + } else unregister_code16(keycode); + break; +#endif // RGB_MATRIX_ENABLE default: if (record->event.pressed) { #ifdef RGB_MATRIX_ENABLE diff --git a/users/jonavin/jonavin.h b/users/jonavin/jonavin.h index 894feddfd96..5f467bc845f 100644 --- a/users/jonavin/jonavin.h +++ b/users/jonavin/jonavin.h @@ -36,6 +36,7 @@ enum custom_user_keycodes { KC_WINLCK, //Toggles Win key on and off RGB_TOI, // Timeout idle time up RGB_TOD, // Timeout idle time down + RGB_NITE // Turns off all rgb but allow rgb indicators to work }; #define KC_CAD LALT(LCTL(KC_DEL)) @@ -57,11 +58,13 @@ enum custom_user_keycodes { #endif // TD_LSFT_CAPSLOCK_ENABLE - #ifdef RGB_MATRIX_ENABLE //RGB custom colours #define RGB_GODSPEED 0x00, 0xE4, 0xFF // colour for matching keycaps #define RGB_NAUTILUS 0x00, 0xA4, 0xA9 // Nautilus Font colours + + void activate_rgb_nightmode (bool turn_on); + bool get_rgb_nightmode(void); #endif diff --git a/users/jonavin/rules.mk b/users/jonavin/rules.mk index 4e9ee08ff72..e2918d9e263 100644 --- a/users/jonavin/rules.mk +++ b/users/jonavin/rules.mk @@ -11,3 +11,6 @@ endif ifeq ($(strip $(STARTUP_NUMLOCK_ON)), yes) OPT_DEFS += -DSTARTUP_NUMLOCK_ON endif +ifeq ($(strip $(COLEMAK_LAYER_ENABLE)), yes) + OPT_DEFS += -DCOLEMAK_LAYER_ENABLE +endif