From 88ca4ec2cbbe004cb51f36311f7490537128bce0 Mon Sep 17 00:00:00 2001 From: Donald Kjer Date: Mon, 25 Jan 2021 09:30:17 -0800 Subject: Add support for the DURGOD Taurus K320 keyboard (#11399) * Initial support for Durgod K320 with BootMagic Lite - Adding missing files - Add Unicode Map Support & new user keymap - Remove personalized features from Default keymap - Added Unicode Map to both Default and kuenhlee keymap.c - Updated readme.md - Added additional Fn Shortcut keys * Additional support for Durgod K320 - Simplifying default keymap - Renaming durgod_k320 => durgod/k320 - Removing copy of ST_NUCLEO64_F070RB from K320. Replacing with local board.h - Adding Mac keyboard layout for K320 as alternative via Fn+F12 - Implementing Windows Key lock on K320 - Cleaning up duplicated core functionality - Adding default_toggle_mac_windows keymap with: - Ability to toggle between Windows and MacOS layout - Mac Media Lock functionality. * Updating K320 keymap readme Co-authored-by: kuenhlee --- keyboards/durgod/k320/keymaps/default/keymap.c | 97 ++++++ keyboards/durgod/k320/keymaps/default/readme.md | 14 + .../keymaps/default_toggle_mac_windows/keymap.c | 373 +++++++++++++++++++++ .../keymaps/default_toggle_mac_windows/readme.md | 64 ++++ keyboards/durgod/k320/keymaps/kuenhlee/keymap.c | 154 +++++++++ keyboards/durgod/k320/keymaps/kuenhlee/readme.md | 38 +++ keyboards/durgod/k320/keymaps/kuenhlee/rules.mk | 4 + 7 files changed, 744 insertions(+) create mode 100644 keyboards/durgod/k320/keymaps/default/keymap.c create mode 100644 keyboards/durgod/k320/keymaps/default/readme.md create mode 100644 keyboards/durgod/k320/keymaps/default_toggle_mac_windows/keymap.c create mode 100644 keyboards/durgod/k320/keymaps/default_toggle_mac_windows/readme.md create mode 100644 keyboards/durgod/k320/keymaps/kuenhlee/keymap.c create mode 100644 keyboards/durgod/k320/keymaps/kuenhlee/readme.md create mode 100644 keyboards/durgod/k320/keymaps/kuenhlee/rules.mk (limited to 'keyboards/durgod/k320/keymaps') diff --git a/keyboards/durgod/k320/keymaps/default/keymap.c b/keyboards/durgod/k320/keymaps/default/keymap.c new file mode 100644 index 0000000000..64b98acffc --- /dev/null +++ b/keyboards/durgod/k320/keymaps/default/keymap.c @@ -0,0 +1,97 @@ +/* Copyright 2021 kuenhlee and Don Kjer + * + * 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 . + */ +#include QMK_KEYBOARD_H + +// Layer shorthand +enum _layer { + _BASE, + _FUNC +}; + +static bool win_key_locked = false; + +// Defines the keycodes used by our macros in process_record_user +enum custom_keycodes { + KC_TGUI = SAFE_RANGE // Toggle between GUI Lock or Unlock +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap _BASE: Base Layer (Default Layer) + * ,-----------------------------------------------------------. ,--------------. + * |Esc |f1| f2| f3| f4| | f5| f6| f7| f8| | f9|f10|f11|f12| |Prnt|ScLk|Paus| + * |-----------------------------------------------------------| |--------------| + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0| - | = |Backsp | | Ins|Home|PgUp| + * |-----------------------------------------------------------| |--------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | Del| End|PgDn| + * |-----------------------------------------------------------| `--------------' + * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | + * |-----------------------------------------------------------| ,----. + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | | Up | + * |-----------------------------------------------------------| ,-------------. + * |Ctrl|Gui |Alt | Space |Alt |Func |App |Ctrl| |Lft| Dn |Rig | + * `-----------------------------------------------------------' `-------------' + */ + [_BASE] = LAYOUT_tkl_ansi( /* Base Layer */ + 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_PSCR, KC_SLCK, KC_PAUS, + 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_INS, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_DEL, KC_END, KC_PGDN, + 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_ENT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FUNC),KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, + KC_RGHT + ), + /* Keymap _FUNC: Function Layer + * ,-----------------------------------------------------------. ,--------------. + * | |Play|Stop|Prev|Next| |Mute|Vol+|Vol-| | | | | | | | | | | + * |-----------------------------------------------------------| |--------------| + * | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| |--------------| + * | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| `--------------' + * | | | | | | | | | | | | | | + * |-----------------------------------------------------------| ,----. + * | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| ,-------------. + * | |Lock| | | |Func | | | | | | | + * `-----------------------------------------------------------' `-------------' + */ + [_FUNC] = LAYOUT_tkl_ansi( /* Function Layer */ + _______, KC_MPLY, KC_MSTP, KC_MRWD, KC_MFFD, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_TGUI, _______, _______, _______, _______, _______, _______, _______, _______, + _______ + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_TGUI: + if (!record->event.pressed) { + // Toggle GUI lock on key release + win_key_locked = !win_key_locked; + writePin(LED_WIN_LOCK_PIN, !win_key_locked); + } + break; + case KC_LGUI: + if (win_key_locked) { return false; } + break; + } + return true; +} + diff --git a/keyboards/durgod/k320/keymaps/default/readme.md b/keyboards/durgod/k320/keymaps/default/readme.md new file mode 100644 index 0000000000..e26c79c8ae --- /dev/null +++ b/keyboards/durgod/k320/keymaps/default/readme.md @@ -0,0 +1,14 @@ +# The default keymap for Durgod Taurus K320. + +Layer 0 : Standard ANSI 87 Keys TKL layout (Windows) + +Layer 1 : Media control and Windows lock key +- Reusing Durgod's Original Media Control for Fn + F1 ~ Fn + F7 +- Fn + Windows to toggle Windows lock key functionality + +## Windows key lock + +You can hold down Fn + Windows key to disable the Windows key while in locked mode. +The 'Lock' LED indicates if the Windows key is locked. + +This is similar to the stock K320 Windows key lock functionality. diff --git a/keyboards/durgod/k320/keymaps/default_toggle_mac_windows/keymap.c b/keyboards/durgod/k320/keymaps/default_toggle_mac_windows/keymap.c new file mode 100644 index 0000000000..7fcf52cfe0 --- /dev/null +++ b/keyboards/durgod/k320/keymaps/default_toggle_mac_windows/keymap.c @@ -0,0 +1,373 @@ +/* Copyright 2021 kuenhlee and Don Kjer + * + * 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 . + */ +#include QMK_KEYBOARD_H + +// Layer shorthand +enum _layer { + _WBL, + _WFL, + _WSL, + _MBL, + _MFL, + _MSL +}; + +#ifndef DEFAULT_LAYOUT +# define DEFAULT_LAYOUT _WBL // Change to _MBL to boot into Mac layout. +#endif +#ifndef ALT_LAYOUT +# define ALT_LAYOUT _MBL // Layout to display 'MR' led when active. +#endif + +static bool win_key_locked = false; +static bool mac_media_locked = false; +static bool win_appkey_pressed = false; +static bool mac_fnkey_pressed = false; + + +// Defines the keycodes used by our macros in process_record_user +enum custom_keycodes { + KC_TGUI = SAFE_RANGE, // Toggle between GUI Lock or Unlock (Windows) + KC_TMED, // Toggle between Fx keys or Media keys (Mac) + KC_WFN, // Windows function key + KC_MFN, // Mac function key + MO_WSL, // Windows system key + MO_MSL, // Mac system key + DF_W2MBL, // Change layout from Windows to Mac + DF_M2WBL // Change layout from Mac to Windows +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap _WBL: Windows Base Layer (Default Layer) + * ,-----------------------------------------------------------. ,--------------. + * |Esc |f1| f2| f3| f4| | f5| f6| f7| f8| | f9|f10|f11|f12| |Prnt|ScLk|Paus| + * |-----------------------------------------------------------| |--------------| + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0| - | = |Backsp | | Ins|Home|PgUp| + * |-----------------------------------------------------------| |--------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | Del| End|PgDn| + * |-----------------------------------------------------------| `--------------' + * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | + * |-----------------------------------------------------------| ,----. + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | | Up | + * |-----------------------------------------------------------| ,-------------. + * |Ctrl|Gui |Alt | Space |Alt |Func |App|Ctrl | |Lft| Dn |Rig | + * `-----------------------------------------------------------' `-------------' + */ + [_WBL] = LAYOUT_tkl_ansi( /* Windows Base Layer */ + 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_PSCR, KC_SLCK, KC_PAUS, + 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_INS, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_DEL, KC_END, KC_PGDN, + 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_ENT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_WFN, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, + KC_RGHT + ), + /* Keymap _WFL: Windows Function Layer + * ,-----------------------------------------------------------. ,--------------. + * | |Play|Stop|Prev|Next| |Mute|Vol+|Vol-| | | | | | | | | | | + * |-----------------------------------------------------------| |--------------| + * | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| |--------------| + * | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| `--------------' + * | | | | | | | | | | | | | | + * |-----------------------------------------------------------| ,----. + * | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| ,-------------. + * | |Lock| | | |Func |Sys| | | | | | + * `-----------------------------------------------------------' `-------------' + */ + [_WFL] = LAYOUT_tkl_ansi( /* Windows First Layer */ + _______, KC_MPLY, KC_MSTP, KC_MRWD, KC_MFFD, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, KC_TGUI, _______, _______, _______, _______, MO_WSL, _______, _______, _______, + _______ + ), + /* Keymap _WSL: Windows System Layer + * ,-----------------------------------------------------------. ,--------------. + * |Reset |Sleep| | |Power| | | | | | | | | |MAC| | | + * |-----------------------------------------------------------| |--------------| + * | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| |--------------| + * | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| `--------------' + * | | | | | | | | | | | | | | + * |-----------------------------------------------------------| ,----. + * | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| ,-------------. + * | | | | | |Func |Sys| | | | | | + * `-----------------------------------------------------------' `-------------' + */ + [_WSL] = LAYOUT_tkl_ansi( /* Windows Second / System Layer */ + RESET, KC_SLEP, XXXXXXX, XXXXXXX, KC_PWR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DF_W2MBL, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, DEBUG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX + ), + + /* Keymap _MBL: Mac Base Layer (Alternate Layout) + * ,-----------------------------------------------------------. ,--------------. + * |Esc |f1| f2| f3| f4| | f5| f6| f7| f8| | f9|f10|f11|f12| | f13| f14| f15| + * |-----------------------------------------------------------| |--------------| + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0| - | = |Backsp | | Ins|Home|PgUp| + * |-----------------------------------------------------------| |--------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \| | Del| End|PgDn| + * |-----------------------------------------------------------| `--------------' + * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | + * |-----------------------------------------------------------| ,----. + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | | Up | + * |-----------------------------------------------------------| ,-------------. + * |Ctrl|Alt |Gui | Space |Gui |Alt|Func |Ctrl | |Lft| Dn |Rig | + * `-----------------------------------------------------------' `-------------' + */ + [_MBL] = LAYOUT_tkl_ansi( /* Mac Base Layer */ + 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_F13, KC_F14, KC_F15, + 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_INS, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_DEL, KC_END, KC_PGDN, + 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_ENT, KC_UP, + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, KC_MFN, KC_RCTL, KC_LEFT, KC_DOWN, + KC_RGHT + ), + /* Keymap _MFL: Mac Function Layer + * ,-----------------------------------------------------------. ,--------------. + * | |Bri-|Bri+|MCon|LPad| | | |Prv|Ply| |Nxt|Mute|Vol-|Vol+| |TMed| | | + * |-----------------------------------------------------------| |--------------| + * | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| |--------------| + * | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| `--------------' + * | | | | | | | | | | | | | | + * |-----------------------------------------------------------| ,----. + * | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| ,-------------. + * | | | | | |Sys|Func | | | | | | + * `-----------------------------------------------------------' `-------------' + */ + [_MFL] = LAYOUT_tkl_ansi( /* Mac First Layer */ + _______, KC_BRID, KC_BRIU, _______, _______, _______, _______, KC_MRWD, KC_MPLY, KC_MFFD, KC_MUTE, KC_VOLD, KC_VOLU, KC_TMED, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, MO_MSL, _______, _______, _______, _______, + _______ + ), + /* Keymap _MSL: Mac System Layer + * ,-----------------------------------------------------------. ,--------------. + * |Reset | | | |Sleep| | | | | | | | | |WIN| | | + * |-----------------------------------------------------------| |--------------| + * | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| |--------------| + * | | | | | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| `--------------' + * | | | | | | | | | | | | | | + * |-----------------------------------------------------------| ,----. + * | | | | | | | | | | | | | | | + * |-----------------------------------------------------------| ,-------------. + * | | | | | |Sys|Func | | | | | | + * `-----------------------------------------------------------' `-------------' + */ + [_MSL] = LAYOUT_tkl_ansi( /* Mac Second / System Layer */ + RESET, XXXXXXX, XXXXXXX, XXXXXXX, KC_SLEP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, DF_M2WBL, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, DEBUG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX + ) +}; + +void unlock_win_key(void) { + win_key_locked = false; + mac_media_locked = false; + writePinHigh(LED_WIN_LOCK_PIN); +} + +void toggle_lock_win_key(void) { + win_key_locked = !win_key_locked; + writePin(LED_WIN_LOCK_PIN, !win_key_locked); +} + +void toggle_lock_media_key(void) { + mac_media_locked = !mac_media_locked; + writePin(LED_WIN_LOCK_PIN, !mac_media_locked); +} + +#ifdef CONSOLE_ENABLE +void dprint_global_layers(void) { + dprint("Global Layers:"); + if (IS_LAYER_ON(_WFL)) { dprint(" _WFL"); } + if (IS_LAYER_ON(_WSL)) { dprint(" _WSL"); } + if (IS_LAYER_ON(_MFL)) { dprint(" _MFL"); } + if (IS_LAYER_ON(_MSL)) { dprint(" _MSL"); } + dprintf("\n"); +} + +void dprint_layers(layer_state_t state) { + dprint("Layers:"); + if (IS_LAYER_ON_STATE(state, _WFL)) { dprint(" _WFL"); } + if (IS_LAYER_ON_STATE(state, _WSL)) { dprint(" _WSL"); } + if (IS_LAYER_ON_STATE(state, _MFL)) { dprint(" _MFL"); } + if (IS_LAYER_ON_STATE(state, _MSL)) { dprint(" _MSL"); } + dprintf("\n"); +} +#endif + +layer_state_t default_layer_state_set_user(layer_state_t state) { +#ifdef CONSOLE_ENABLE + dprintf("default_layer_state_set_user: 0x%x\n", state); + dprint_global_layers(); +#endif + // Disable windows key lock on default layer transition. + unlock_win_key(); + win_appkey_pressed = false; + mac_fnkey_pressed = false; + writePin(LED_MR_LOCK_PIN, !IS_LAYER_ON_STATE(state, ALT_LAYOUT)); + return state; +} + +layer_state_t layer_state_set_user(layer_state_t state) { +#ifdef CONSOLE_ENABLE + dprintf("layer_state_set_user: 0x%x\n", state); + dprint_layers(state); +#endif + return state; +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_TGUI: + if (!record->event.pressed) { + // Toggle GUI lock on key release + toggle_lock_win_key(); + } + break; + case KC_TMED: + // Only trigger when Fn key is also held down, to avoid accidental unlock. + if (!mac_fnkey_pressed) { return false; } + if (!record->event.pressed) { + // Toggle Media Lock on key release + toggle_lock_media_key(); + } + break; + case KC_LGUI: + if (win_key_locked) { return false; } + break; + case KC_WFN: + // Like MO(_WFL), but also enables _WSL if KC_APP is already pressed down. + if (record->event.pressed) { + layer_on(_WFL); + if (win_appkey_pressed) { + // Also enable Secondary layer if App key is being held down. + win_appkey_pressed = false; + layer_on(_WSL); + } + } else { + if (IS_LAYER_ON(_WFL)) { layer_off(_WFL); } + if (IS_LAYER_ON(_MSL)) { layer_off(_MSL); } + } + break; + case KC_APP: + if (record->event.pressed) { + // Don't actually press down the app menu key + win_appkey_pressed = true; + } else { + if (IS_LAYER_ON(_WSL)) { layer_off(_WSL); } + if (IS_LAYER_ON(_MFL)) { layer_off(_MFL); } + if (win_appkey_pressed) { + win_appkey_pressed = false; + // Tap the KC_APP key on key release. + tap_code(KC_APP); + } + } + return false; + break; + case KC_MFN: + // Mac Fn key. Emit Fn keycode, and also transition layers similar to KC_WFN. + if (record->event.pressed) { + mac_fnkey_pressed = true; + layer_on(_MFL); + // Also enable Secondary layer if Right-Alt key is being held down. + if (get_mods() & MOD_BIT(KC_RALT)) { + layer_on(_MSL); + } + } else { + mac_fnkey_pressed = false; + if (!mac_media_locked) { + if (IS_LAYER_ON(_MFL)) { layer_off(_MFL); } + if (IS_LAYER_ON(_WSL)) { layer_off(_WSL); } + } + } + break; + case KC_RALT: + // Disable MSL/WFL layer on key-up. + if (!record->event.pressed) { + if (IS_LAYER_ON(_MSL)) { layer_off(_MSL); } + if (IS_LAYER_ON(_WFL)) { layer_off(_WFL); } + } + break; + case MO_WSL: + if (record->event.pressed) { + layer_on(_WSL); + } else { + if (IS_LAYER_ON(_WSL)) { layer_off(_WSL); } + if (IS_LAYER_ON(_MFL)) { layer_off(_MFL); } + } + break; + case MO_MSL: + if (record->event.pressed) { + layer_on(_MSL); + } else { + if (IS_LAYER_ON(_MSL)) { layer_off(_MSL); } + if (IS_LAYER_ON(_WFL)) { layer_off(_WFL); } + } + break; + case DF_W2MBL: + if (!record->event.pressed) { + // Switch base layer, but preserve first/secondary layers. + default_layer_set(1UL<<_MBL); + layer_state_set(1UL<<_MFL | 1UL<<_MSL); + } + break; + case DF_M2WBL: + if (!record->event.pressed) { + // Switch base layer, but preserve first/secondary layers. + default_layer_set(1UL<<_WBL); + layer_state_set(1UL<<_WFL | 1UL<<_WSL); + } + break; + case RESET: + if (record->event.pressed) { + // Flash LEDs to indicate bootloader mode is enabled. + on_all_leds(); + } + break; + } + return true; +} + +void keyboard_post_init_user(void) { + default_layer_set(1UL<. + */ +#include QMK_KEYBOARD_H + +// Layer shorthand +#define _BL 0u +#define _FL 1u // Multimedia Related, Virtual Desktop control +#define _SL 2u // Just for System Related +#define _UL 3u // Unicode Map + +#define KC_ADTP LGUI(LCTL(KC_D)) // Adding New Virtual Desktop +#define KC_DDTP LGUI(LCTL(KC_F4)) // Deleting / Removing Current Virtual Desktop +#define KC_NDTP LGUI(LCTL(KC_RGHT)) // Navigate to the Next Virtual Desktop +#define KC_PDTP LGUI(LCTL(KC_LEFT)) // Navigate to the Previous Virtual Desktop +#define KC_WINL LGUI(KC_LEFT) // Snap Windows to Left +#define KC_WINR LGUI(KC_RGHT) // Snap Windows to Right +#define KC_WINU LGUI(KC_UP) // Maximize the Window +#define KC_WIND LGUI(KC_DOWN) // Minimize the desktop window +#define KC_TASK LCTL(LSFT(KC_ESC)) // Launch Task Manager + +#define KC_FIND LCTL(LSFT(KC_F)) // Find In Files +#define KC_STOP LCTL(LSFT(KC_HOME)) // Select from Cursor to Home +#define KC_SEND LCTL(LSFT(KC_END)) // Select from Cursor to End + +// Defines the keycodes used by our macros in process_record_user +enum custom_keycodes { + KC_TGUI = SAFE_RANGE // Toggle between GUI Lock or Unlock +}; + +// °±²³µ©ΩθΩ√∞∆≈≠→↓←↑≡■□●○∴«»÷≤≥Σ +// Defines the Enumeration for Unicode Map +enum unicode_names { + DEGR, + PONE, + POW2, + POW3, + MYU, + COPY, + THET, + OHM, + SQRT, + INFI, + DELT, + APPR, + NEQU, + RARR, + DARR, + LARR, + UARR, + SAME, + BSQR, + WSQR, + BDOT, + WDOT, + THFR, + DIV, + LTOE, + MTOE, + DLAR, + DRAR, + SUM, +}; + +const uint32_t PROGMEM unicode_map[] = { + [DEGR] = 0x00B0, // ° + [PONE] = 0x00B1, // ± + [POW2] = 0x00B2, // ² + [POW3] = 0x00B3, // ³ + [MYU] = 0x00B5, // µ + [COPY] = 0x00A9, // © + [THET] = 0x03B8, // θ + [OHM] = 0x2126, // Ω + [SQRT] = 0x221A, // √ + [INFI] = 0x221E, // ∞ + [DELT] = 0x0394, // ∆ + [APPR] = 0x2248, // ≈ + [NEQU] = 0x2260, // ≠ + [RARR] = 0x2192, // → + [DARR] = 0x2193, // ↓ + [LARR] = 0x2190, // ← + [UARR] = 0x2191, // ↑ + [SAME] = 0x2261, // ≡ + [BSQR] = 0x25A0, // ■ + [WSQR] = 0x25A1, // □ + [BDOT] = 0x25CF, // ● + [WDOT] = 0x25CB, // ○ + [THFR] = 0x2234, // ∴ + [DIV] = 0x00F7, // ÷ + [LTOE] = 0x2264, // ≤ + [MTOE] = 0x2265, // ≥ + [DLAR] = 0x00AB, // « + [DRAR] = 0x00BB, // » + [SUM] = 0x03A3 // Σ +}; + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BL] = LAYOUT_tkl_ansi( /* Base Layer */ + 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_PSCR, KC_SLCK, KC_PAUS, + 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_INS, KC_HOME, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_DEL, KC_END, KC_PGDN, + 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_ENT, KC_UP, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FL), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, + KC_RGHT + ), + + [_FL] = LAYOUT_tkl_ansi( /* First Layer */ + KC_TRNS, KC_MPLY, KC_MSTP, KC_MRWD, KC_MFFD, KC_MUTE, KC_VOLD, KC_VOLU, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_CALC, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PDTP, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_TASK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MSEL, XXXXXXX, XXXXXXX, XXXXXXX, KC_ADTP, KC_STOP, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_FIND, KC_WHOM, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_DDTP, KC_SEND, KC_NDTP, + XXXXXXX, XXXXXXX, XXXXXXX, KC_MYCM, XXXXXXX, XXXXXXX, XXXXXXX, KC_MAIL, XXXXXXX, XXXXXXX, XXXXXXX, KC_MENU, XXXXXXX, KC_WINU, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, MO(_SL), KC_TRNS, MO(_UL), XXXXXXX, KC_WINL, KC_WIND, + KC_WINR + ), + + [_SL] = LAYOUT_tkl_ansi( /* Second Layer */ + XXXXXXX, KC_SLEP, XXXXXXX, XXXXXXX, KC_PWR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_TRNS, KC_TRNS, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX + ), + + [_UL] = LAYOUT_tkl_ansi( /* Unicode Layer */ + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + X(APPR), X(NEQU), X(POW2), X(POW3), XXXXXXX, XXXXXXX, X(BSQR), X(WSQR), X(INFI), X(BDOT), X(WDOT), XXXXXXX, X(PONE), XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, X(SUM), XXXXXXX, X(MYU), X(SAME), XXXXXXX, X(OHM), X(DLAR), X(DRAR), XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, X(SQRT), X(DELT), XXXXXXX, XXXXXXX, X(THFR), XXXXXXX, XXXXXXX, XXXXXXX, X(THET), X(DEGR), XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, X(COPY), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, X(LTOE), X(MTOE), X(DIV), XXXXXXX, XXXXXXX, X(UARR), + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_TRNS, KC_TRNS, XXXXXXX, X(LARR), X(DARR), + X(RARR) + ) +}; + +void matrix_init_user(void) { + set_unicode_input_mode(UC_WINC); +} diff --git a/keyboards/durgod/k320/keymaps/kuenhlee/readme.md b/keyboards/durgod/k320/keymaps/kuenhlee/readme.md new file mode 100644 index 0000000000..60925e61cf --- /dev/null +++ b/keyboards/durgod/k320/keymaps/kuenhlee/readme.md @@ -0,0 +1,38 @@ +# The kuenhlee keymap for Durgod Taurus K320. + +Layer 0 : Standard ANSI 87 Keys TKL layout +------------------------------------------ + +Layer 1 : Media control and Key Modifier for Virtual Desktop navagation +----------------------------------------------------------------------- +- Reusing Durgod's Original Media Control for Fn + F1 ~ Fn + F7 + - Fn + F12 Remapped to Launch Calculator + - Fn + M To Launch Media Player + - Fn + P To Mail Client + - Fn + G To Launch Web Browswer / Nagivate to Homepage + - Fn + C To Launch My Computer + - Fn + T Launch Task Manager + - Fn + F Find in Files ( Notepad ++ ) + +- Windows's Virtual Desktop Navigation + - Fn + Ins To add New Virtual Desktop + - Fn + Del To Delete / Remove Current Virtual Desktop + - Fn + PgUp Navigate to the Next Virtual Desktop + - Fn + PgDn Navigate to the Previous Virtual Desktop + +- Windows ShortKeys + - Fn + Left Snap Windows to Left + - Fn + Right Snap Windows to Right + - Fn + Up Maximize the Window + - Fn + Down Minimize the desktop window + - Fn + Home Select from Cursor to Home + - Fn + End Select from Cursor to End + +Layer 2 : Mainly for Windows Sleep and Shutdown +----------------------------------------------- +- Fn + R-ALT + F1 : System Sleep +- Fn + R-ALT + F4 : Turning Off System + +Layer Unicode : Mainly for Predefined Unicode code to work with WinCompose +-------------------------------------------------------------------------- +- °±²³µ©ΩθΩ√∞∆≈≠→↓←↑≡■□●○∴«»÷≤≥Σ \ No newline at end of file diff --git a/keyboards/durgod/k320/keymaps/kuenhlee/rules.mk b/keyboards/durgod/k320/keymaps/kuenhlee/rules.mk new file mode 100644 index 0000000000..b6a7e51c10 --- /dev/null +++ b/keyboards/durgod/k320/keymaps/kuenhlee/rules.mk @@ -0,0 +1,4 @@ +# Build Options +# change yes to no to disable +# +UNICODEMAP_ENABLE = yes # Enable Unicode Map -- cgit v1.2.3