1
0
Fork 0

Migrate more fn_actions stuff (#13502)

This commit is contained in:
Ryan 2021-07-15 03:52:45 +10:00 committed by GitHub
parent e69c325a9c
commit fd8628ccdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 507 additions and 801 deletions

View file

@ -1,6 +1,3 @@
// this is the style you want to emulate.
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
#include QMK_KEYBOARD_H
// Each layer gets a name for readability, which is then used in the keymap matrix below.
@ -23,21 +20,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_LPRN, KC_RPRN, KC_MINS, KC_EQL , KC_LBRC,
KC_TAB , KC_5 , KC_6 , KC_7 , KC_8 , KC_LEFT, KC_DOWN, KC_UP , KC_RGHT, KC_RBRC,
_______, KC_9 , KC_0 , KC_DOT , KC_COMM, KC_HOME, KC_PGDN, KC_PGUP, KC_END , _______,
_______, _______, _______, _______, KC_DEL , F(MOUS), _______, _______, _______, _______, _______, _______
_______, _______, _______, _______, KC_DEL , TG(MOUS), _______, _______, _______, _______, _______, _______
),
[MOUS] = LAYOUT( /* Mouse and Media Keys */
KC_SLCK, KC_PAUSE, KC_F11 , KC_F10 , KC_F9 , KC_F8 , KC_F7 , KC_F6 , KC_F5 , KC_F4,
KC_VOLD, KC_ACL0 , KC_ACL1, KC_ACL2, KC_VOLU, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_F3,
KC_MUTE, KC_MPRV , KC_MPLY, KC_MNXT, KC_MUTE, KC_WH_R, KC_WH_U, KC_WH_D, KC_WH_L, KC_F2,
_______, _______ , _______, _______, _______, _______, _______, KC_BTN1, F(BASE), RESET , KC_F12 , KC_F1
_______, _______ , _______, _______, _______, _______, _______, KC_BTN1, TO(BASE), RESET , KC_F12 , KC_F1
),
};
// I prefer this layer switching strategy to the TG and MO functions.
// so that I can get out of mouse mode just by tapping/holding my base layer FN key.
const uint16_t PROGMEM fn_actions[] = {
[BASE] = ACTION_LAYER_OFF(2, 1), // switch back to layer 0
[MOUS] = ACTION_LAYER_ON(2, 1) // switch to layer 2
};

View file

@ -16,12 +16,6 @@ enum layers {
#define KM_DRIGHT LGUI(LCTL(KC_RIGHT))
#define TSKMGR LCTL(LSFT(KC_ESC))
#define tap_mod_macro(record, mod, macro) ( ((record)->event.pressed) ? \
( ((record)->tap.count <= 0 || (record)->tap.interrupted) ? MACRO(D(mod), END) : MACRO_NONE ) : \
( ((record)->tap.count > 0 && !((record)->tap.interrupted)) ? (macro) : MACRO(U(mod), END) ) )
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[ALPH] = LAYOUT(
KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,
@ -54,21 +48,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
)
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_MACRO_TAP(1),
[2] = ACTION_MACRO_TAP(2)
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
switch(id) {
case 1:
return tap_mod_macro(record, LGUI, MACRO( D(LSFT), T(9), U(LSFT), END));
break;
case 2:
return tap_mod_macro(record, LALT, MACRO( D(LSFT), T(0), U(LSFT), END));
break;
}
return MACRO_NONE;
};

View file

@ -1,12 +1,6 @@
#include QMK_KEYBOARD_H
#include "mousekey.h"
#undef C
#undef S
#define C(kc) LCTL(KC_##kc)
#define S(kc) LSFT(KC_##kc)
#define RA(kc) RALT(KC_##kc)
#define KC_SLCT KC_SELECT
#define MEDAPP LT(MEDIA, KC_APP)
uint8_t current_layer_global = 255;
@ -21,19 +15,16 @@ enum layers {
MISC,
};
enum function_id {
LSHFT_PAREN,
enum custom_keycodes {
LSHFT_PAREN = SAFE_RANGE,
RSHFT_PAREN,
LCTRL_BRACKET,
RCTRL_BRACKET,
LALT_CURLY,
RALT_CURLY,
CTRL_CLICK
};
enum macro_id {
GRV,
CFLEX
CTRL_CLICK,
M_GRV,
M_CFLEX
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@ -42,25 +33,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
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_INS,KC_HOME,KC_PGUP, KC_NLCK,KC_PSLS,KC_PAST,KC_PMNS, \
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_DEL, KC_END,KC_PGDN, KC_P7, KC_P8, KC_P9,KC_PPLS, \
TT(MOUSE1), 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_P4, KC_P5, KC_P6, \
F(8),KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, F(9), KC_UP, KC_P1, KC_P2, KC_P3,KC_PENT, \
F(1),KC_LGUI, F(3), LT(MISC, KC_SPC), F(4),TT(PROG1), MEDAPP, F(2), KC_LEFT,KC_DOWN,KC_RGHT, KC_P0,KC_PDOT),
LSHFT_PAREN,KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M,KC_COMM, KC_DOT,KC_SLSH, RSHFT_PAREN, KC_UP, KC_P1, KC_P2, KC_P3,KC_PENT, \
LCTRL_BRACKET,KC_LGUI, LALT_CURLY, LT(MISC, KC_SPC), RALT_CURLY,TT(PROG1), MEDAPP, RCTRL_BRACKET, KC_LEFT,KC_DOWN,KC_RGHT, KC_P0,KC_PDOT),
/* Layer 1: Programming Layer 1, emulating US l ayout */
[PROG1] = LAYOUT(\
KC_ESC,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \
M(GRV),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,KC_SLSH, S(0),_______, _______,_______,_______, _______,_______,_______,_______, \
_______,_______,_______,_______,_______,_______, KC_Z,_______,_______,_______,_______, RA(8), RA(9),RA(MINS), _______,_______,_______, _______,_______,_______,_______, \
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,S(COMM),S(BSLS), _______, _______,_______,_______, \
MO(PROG2),_______, KC_Y,_______,_______,_______,_______,_______,_______,_______,_______, S(7), MO(PROG2), _______, _______,_______,_______,_______, \
M_GRV,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,KC_SLSH,S(KC_0),_______, _______,_______,_______, _______,_______,_______,_______, \
_______,_______,_______,_______,_______,_______, KC_Z,_______,_______,_______,_______,ALGR(KC_8),ALGR(KC_9),ALGR(KC_MINS), _______,_______,_______, _______,_______,_______,_______, \
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,S(KC_COMM),S(KC_BSLS), _______, _______,_______,_______, \
MO(PROG2),_______, KC_Y,_______,_______,_______,_______,_______,_______,_______,_______, S(KC_7), MO(PROG2), _______, _______,_______,_______,_______, \
_______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______, _______,_______),
/* Layer 2: programming layer 2
all keys that are not FN keys are sent as LSFT+key on this layer
*/
[PROG2] = LAYOUT(\
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \
RA(RBRC),_______, RA(Q),KC_BSLS,_______,_______,M(CFLEX), S(6),S(RBRC), S(8), S(9),S(SLSH),KC_RBRC,_______, _______,_______,_______, _______,_______,_______,_______, \
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, RA(7), RA(0),RA(NUBS), _______,_______,_______, _______,_______,_______,_______, \
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, S(DOT), S(2), _______, _______,_______,_______, \
_______,S(NUBS),_______,_______,_______,_______,_______,_______,_______,KC_NUBS,S(NUBS),S(MINS), _______, _______, _______,_______,_______,_______, \
ALGR(KC_RBRC),_______, ALGR(KC_Q),KC_BSLS,_______,_______,M_CFLEX, S(KC_6),S(KC_RBRC), S(KC_8),S(KC_9),S(KC_SLSH),KC_RBRC,_______, _______,_______,_______, _______,_______,_______,_______, \
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, ALGR(KC_7),ALGR(KC_0),ALGR(KC_NUBS), _______,_______,_______, _______,_______,_______,_______, \
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, S(KC_DOT), S(KC_2), _______, _______,_______,_______, \
_______,S(KC_NUBS),_______,_______,_______,_______,_______,_______,_______,KC_NUBS,S(KC_NUBS),S(KC_MINS), _______, _______, _______,_______,_______,_______, \
_______,_______,_______, _______, _______,_______,_______,_______, _______,_______,_______, _______,_______),
/* Layer 3: media layer */
[MEDIA] = LAYOUT(\
@ -72,11 +63,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX,_______,XXXXXXX, KC_MRWD,KC_MSTP,KC_MFFD, XXXXXXX,XXXXXXX),
/* Layer 4: Mouse layer */
[MOUSE1] = LAYOUT(\
F(6),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \
TO(DEFAULT),_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, \
_______,KC_ACL0,KC_ACL1,KC_ACL2,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \
_______,KC_BTN4,KC_WH_D,KC_MS_U,KC_WH_U,_______, C(Z),_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \
_______,KC_BTN5,KC_MS_L,KC_MS_D,KC_MS_R, F(7),KC_WH_L,KC_WH_D,KC_WH_U,KC_WH_R,_______,_______, _______, _______,_______,_______, \
MO(MOUSE2),_______, C(Y), C(X), C(C), C(V),_______,KC_BTN2,KC_BTN3,C(PGUP),C(PGDN),_______, KC_RSFT, _______, _______,_______,_______,_______, \
_______,KC_BTN4,KC_WH_D,KC_MS_U,KC_WH_U,_______, C(KC_Z),_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \
_______,KC_BTN5,KC_MS_L,KC_MS_D,KC_MS_R, CTRL_CLICK,KC_WH_L,KC_WH_D,KC_WH_U,KC_WH_R,_______,_______, _______, _______,_______,_______, \
MO(MOUSE2),_______,C(KC_Y),C(KC_X),C(KC_C),C(KC_V),_______,KC_BTN2,KC_BTN3,C(KC_PGUP),C(KC_PGDN),_______, KC_RSFT, _______, _______,_______,_______,_______, \
KC_LCTL,_______,KC_LALT, KC_BTN1, KC_RALT,KC_RGUI, KC_APP,KC_RCTL, _______,_______,_______, _______,_______),
/* Layer 5: Mouse layer 2*/
[MOUSE2] = LAYOUT(\
@ -90,44 +81,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[MISC] = LAYOUT(\
_______, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, _______,_______,_______, \
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \
_______,KC_SLCT, C(W), KC_UP,_______,_______,_______,_______,KC_BSPC, KC_DEL,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \
_______,KC_SLCT, C(KC_W), KC_UP,_______,_______,_______,_______,KC_BSPC, KC_DEL,_______,_______,_______,_______, _______,_______,_______, _______,_______,_______,_______, \
_______,_______,KC_LEFT,KC_DOWN,KC_RGHT,_______,KC_HOME,KC_PGDN,KC_PGUP,_______,_______,_______, _______, _______,_______,_______, \
KC_LSFT,_______, C(Y), C(X), C(C), C(V), KC_SPC, KC_END,_______,C(PGUP),C(PGDN),_______, _______, _______, _______,_______,_______,_______, \
KC_LSFT,_______,C(KC_Y),C(KC_X),C(KC_C),C(KC_V), KC_SPC, KC_END,_______,C(KC_PGUP),C(KC_PGDN),_______, _______, _______, _______,_______,_______,_______, \
_______,_______,_______, LT(MISC, KC_SPC), _______,_______,_______,_______, _______,_______,_______, _______,_______),
};
const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_FUNCTION_TAP(LCTRL_BRACKET), // tap to print [
[2] = ACTION_FUNCTION_TAP(RCTRL_BRACKET), // tap to print ]
[3] = ACTION_FUNCTION_TAP(LALT_CURLY), // tap to print {
[4] = ACTION_FUNCTION_TAP(RALT_CURLY), // tap to print }
[6] = ACTION_LAYER_SET_CLEAR(DEFAULT),
[7] = ACTION_FUNCTION_TAP(CTRL_CLICK),
[8] = ACTION_FUNCTION_TAP(LSHFT_PAREN), // tap to print (
[9] = ACTION_FUNCTION_TAP(RSHFT_PAREN), // tap to print )
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch(id) {
case GRV: // macro to print accent grave
return (record->event.pressed ?
MACRO( D(LSFT), T(EQL), U(RALT), T(SPC), END) :
MACRO_NONE );
case CFLEX: // print accent circonflex
return (record->event.pressed ?
MACRO( T(GRV), T(SPC), END ) :
MACRO_NONE );
}
return MACRO_NONE;
};
void matrix_init_user(void) {
}
void matrix_scan_user(void) {
uint8_t layer;
layer = biton32(layer_state);
@ -147,10 +106,6 @@ void matrix_scan_user(void) {
}
}
void led_set_user(uint8_t usb_led) {
}
void tap_helper(keyrecord_t *record, uint16_t orig_mod, uint16_t macro_mod, uint16_t macro_kc ) {
if (record->event.pressed) {
if (record->tap.count > 0 && !record->tap.interrupted) {
@ -175,47 +130,6 @@ void tap_helper(keyrecord_t *record, uint16_t orig_mod, uint16_t macro_mod, uint
}
}
/* if LCTRL is tabbed, print (, or ) if RCTRL is tabbed, same for LALT/RALT and [/] */
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
// The code is copied from keymap_hasu.c in the tmk keyboards hhkb folder
switch (id) {
case LCTRL_BRACKET:
tap_helper(record, KC_LCTL, KC_RALT, KC_8);
break;
case RCTRL_BRACKET:
tap_helper(record, KC_RCTL, KC_RALT, KC_9);
break;
case LALT_CURLY:
tap_helper(record, KC_LALT, KC_RALT, KC_7);
break;
case RALT_CURLY:
tap_helper(record, KC_RALT, KC_RALT, KC_0);
break;
case LSHFT_PAREN:
tap_helper(record, KC_LSFT, KC_LSFT, KC_8);
break;
case RSHFT_PAREN:
tap_helper(record, KC_RSFT, KC_LSFT, KC_9);
break;
case CTRL_CLICK:
if (record->event.pressed) {
mousekey_clear();
register_mods(MOD_BIT(KC_LCTL));
send_keyboard_report();
wait_ms(5);
mousekey_on(KC_BTN1);
mousekey_send();
wait_ms(10);
mousekey_off(KC_BTN1);
mousekey_send();
wait_ms(5);
unregister_mods(MOD_BIT(KC_LCTL));
send_keyboard_report();
}
break;
}
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
uint8_t layer;
layer = biton32(layer_state);
@ -235,5 +149,51 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
}
switch (keycode) {
case LCTRL_BRACKET:
tap_helper(record, KC_LCTL, KC_RALT, KC_8);
return false;
case RCTRL_BRACKET:
tap_helper(record, KC_RCTL, KC_RALT, KC_9);
return false;
case LALT_CURLY:
tap_helper(record, KC_LALT, KC_RALT, KC_7);
return false;
case RALT_CURLY:
tap_helper(record, KC_RALT, KC_RALT, KC_0);
return false;
case LSHFT_PAREN:
tap_helper(record, KC_LSFT, KC_LSFT, KC_8);
return false;
case RSHFT_PAREN:
tap_helper(record, KC_RSFT, KC_LSFT, KC_9);
return false;
case CTRL_CLICK:
if (record->event.pressed) {
mousekey_clear();
register_mods(MOD_BIT(KC_LCTL));
send_keyboard_report();
wait_ms(5);
mousekey_on(KC_BTN1);
mousekey_send();
wait_ms(10);
mousekey_off(KC_BTN1);
mousekey_send();
wait_ms(5);
unregister_mods(MOD_BIT(KC_LCTL));
send_keyboard_report();
}
return false;
case M_GRV:
tap_code16(S(KC_EQL));
tap_code(KC_SPC);
return false;
case M_CFLEX:
tap_code(KC_GRV);
tap_code(KC_SPC);
return false;
}
return true;
}

View file

@ -40,8 +40,9 @@
// CTRL when held, ESC when tapped
#define CTL_ESC CTL_T(KC_ESC)
// Reset RGB mode to layer signalling
#define RGB_RST F(0)
enum custom_keycodes {
RGB_RST = SAFE_RANGE
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _BL: Base Layer (Default Layer) */
@ -103,21 +104,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#endif
};
/* This is a list of user defined functions. F(N) corresponds to item N
of this list.
*/
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_FUNCTION(0), // Calls action_function()
};
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
switch (id) {
case 0:
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case RGB_RST:
if (record->event.pressed) {
rgblight_mode(1);
rgblight_sethsv(206, 255, 255);
}
return false;
}
return true;
}
enum layer_id {

View file

@ -1,9 +1,6 @@
#include QMK_KEYBOARD_H
#include "tetris_text.h"
// Helpful defines
#define GRAVE_MODS (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)|MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
@ -12,11 +9,15 @@
#define _FL 1
#define _CL 2
enum custom_keycodes {
TETRIS_START = SAFE_RANGE
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap _BL: Base Layer (Default Layer)
*/
[_BL] = LAYOUT(
F(0), 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_GRV, KC_BSPC, KC_PGUP,
KC_GESC, 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_GRV, 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_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RO, KC_RSFT, KC_UP,
@ -41,71 +42,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______,_______, RGB_MOD, RGB_MOD, _______, _______, _______, _______, RGB_HUD, RGB_SAD, RGB_HUI),
};
/* This is a list of user defined functions. F(N) corresponds to item N
of this list.
*/
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_FUNCTION(0), // Calls action_function()
[1] = ACTION_FUNCTION(1)
};
static uint8_t tetris_key_presses = 0;
static uint16_t tetris_timer = 0;
static uint8_t tetris_running = 0;
static int tetris_keypress = 0;
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
static uint8_t mods_pressed;
static bool mod_flag;
switch (id) {
case 0:
// clueboard specific hook to make escape quite tetris
if (tetris_running) {
tetris_running = 0;
return;
}
/* Handle the combined Grave/Esc key
*/
mods_pressed = get_mods()&GRAVE_MODS; // Check to see what mods are pressed
if (record->event.pressed) {
/* The key is being pressed.
*/
if (mods_pressed) {
mod_flag = true;
add_key(KC_GRV);
send_keyboard_report();
} else {
add_key(KC_ESC);
send_keyboard_report();
}
} else {
/* The key is being released.
*/
if (mod_flag) {
mod_flag = false;
del_key(KC_GRV);
send_keyboard_report();
} else {
del_key(KC_ESC);
send_keyboard_report();
}
}
break;
case 1:
if (record->event.pressed) {
tetris_running = 1;
tetris_timer = 0;
tetris_keypress = 0;
// set randomness using total number of key presses
tetris_start(tetris_key_presses);
}
break;
}
}
/*
* Set up tetris
*/
@ -130,6 +71,25 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
}
switch (keycode) {
case KC_GESC:
// clueboard specific hook to make escape quite tetris
if (tetris_running) {
tetris_running = 0;
return false;
}
break;
case TETRIS_START:
if (record->event.pressed) {
tetris_running = 1;
tetris_timer = 0;
tetris_keypress = 0;
// set randomness using total number of key presses
tetris_start(tetris_key_presses);
}
return false;
}
return true;
}
@ -148,57 +108,45 @@ void matrix_scan_user(void) {
}
}
void send_keycode(uint16_t keycode) {
register_code(keycode);
unregister_code(keycode);
}
void send_keycode_shift(uint16_t keycode) {
register_code(KC_LSFT);
register_code(keycode);
unregister_code(keycode);
unregister_code(KC_LSFT);
}
void tetris_send_up(void) {
send_keycode(KC_UP);
tap_code(KC_UP);
}
void tetris_send_left(void) {
send_keycode(KC_LEFT);
tap_code(KC_LEFT);
}
void tetris_send_down(void) {
send_keycode(KC_DOWN);
tap_code(KC_DOWN);
}
void tetris_send_right(void) {
send_keycode(KC_RGHT);
tap_code(KC_RGHT);
}
void tetris_send_backspace(void) {
send_keycode(KC_BSPC);
tap_code(KC_BSPC);
}
void tetris_send_delete(void) {
send_keycode(KC_DEL);
tap_code(KC_DEL);
}
void tetris_send_string(const char *s) {
for (int i = 0; s[i] != 0; i++) {
if (s[i] >= 'a' && s[i] <= 'z') {
send_keycode(KC_A + (s[i] - 'a'));
tap_code(KC_A + (s[i] - 'a'));
} else if (s[i] >= 'A' && s[i] <= 'Z') {
send_keycode_shift(KC_A + (s[i] - 'A'));
tap_code16(S(KC_A + (s[i] - 'A')));
} else if (s[i] >= '1' && s[i] <= '9') {
send_keycode(KC_1 + (s[i] - '1'));
tap_code(KC_1 + (s[i] - '1'));
} else {
switch (s[i]) {
case ' ': send_keycode(KC_SPACE); break;
case '.': send_keycode(KC_DOT); break;
case '0': send_keycode(KC_0); break;
case ' ': tap_code(KC_SPACE); break;
case '.': tap_code(KC_DOT); break;
case '0': tap_code(KC_0); break;
}
}
}
}
void tetris_send_newline(void) {
send_keycode(KC_ENT);
tap_code(KC_ENT);
}
int tetris_get_keypress(void) {

View file

@ -3,6 +3,10 @@
#define _DEFAULT 0
#define _FN 1
enum custom_keycodes {
LED_TOGGLE = SAFE_RANGE
};
int esc_led = 0;
// Fillers to make layering more clear
@ -44,7 +48,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `-----------------------------------------------------------------'
*/
[_FN] = LAYOUT_60_ansi_split_bs_rshift( /* Layer 1 */
F(0), 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_DEL, \
LED_TOGGLE,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_DEL, \
KC_CAPS, ______, ______, ______, ______, ______, ______, ______, KC_PSCR, KC_SLCK, KC_PAUS, KC_UP, ______, ______, \
______, KC_VOLD, KC_VOLU, KC_MUTE, ______, ______, KC_PAST, KC_PSLS, KC_HOME, KC_PGUP, KC_LEFT, KC_RGHT,______, \
______, KC_MPRV, KC_MPLY, KC_MNXT, ______, ______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, ______, ______, \
@ -52,14 +56,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
enum function_id {
LED_TOGGLE
};
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_FUNCTION(LED_TOGGLE)
};
void esc_led_toggle(void) {
if (esc_led == 0){
esc_led = 1;
@ -70,12 +66,13 @@ void esc_led_toggle(void) {
}
}
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
switch (id) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case LED_TOGGLE:
if (record->event.pressed) {
esc_led_toggle();
}
break;
return false;
}
return true;
}

View file

@ -11,20 +11,25 @@
//IS31 chip has 8 available led pages, using 0 for all leds and 7 for single toggles
#define max_pages 6
enum ic60_keycodes {
NUMPAD,
FNAV,
MEDIA,
BACKLIGHT,
BRIGHT,
DIM,
ALL,
GAME,
enum led_modes {
MODE_ALL,
MODE_GAME,
MODE_SINGLE,
MODE_PAGE,
MODE_FLASH
};
enum macro_id {
LED_ALL = SAFE_RANGE,
LED_GAME,
LED_BACKLIGHT,
LED_BRIGHT,
LED_DIM,
LED_SINGLE,
LED_PAGE,
LED_FLASH
};
uint8_t current_layer_global = 0;
uint8_t led_mode_global = MODE_SINGLE;
uint8_t backlight_status_global = 1; //init on/off state of backlight
@ -77,10 +82,10 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* media */
[_MEDIA] = LAYOUT_60_ansi_split_bs_rshift( \
_______,F(MODE_SINGLE),F(MODE_PAGE),F(MODE_FLASH),_______,_______,_______, _______, _______, _______,KC_MUTE, KC_VOLD, KC_VOLU,_______,KC_NO,\
_______,LED_SINGLE,LED_PAGE,LED_FLASH,_______,_______,_______, _______, _______, _______,KC_MUTE, KC_VOLD, KC_VOLU,_______,KC_NO,\
_______,_______,_______,_______,_______,_______,_______, _______, _______, _______,_______, _______,_______,_______,\
_______,_______,_______,_______,_______,F(GAME),_______, _______, _______, _______,_______, _______,_______, \
_______,_______,F(ALL) ,F(BRIGHT),F(DIM),F(BACKLIGHT),_______, _______, KC_MPRV, KC_MNXT,KC_MSTP, _______,KC_NO, \
_______,_______,_______,_______,_______,LED_GAME,_______, _______, _______, _______,_______, _______,_______, \
_______,_______,LED_ALL ,LED_BRIGHT,LED_DIM,LED_BACKLIGHT,_______, _______, KC_MPRV, KC_MNXT,KC_MSTP, _______,KC_NO, \
_______,_______,_______, KC_MPLY, _______,_______, _______,_______ \
),
/* ~ */
@ -101,22 +106,6 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
//id for user defined functions and macros
enum function_id {
NONE,
};
enum macro_id {
ACTION_LEDS_ALL,
ACTION_LEDS_GAME,
ACTION_LEDS_BACKLIGHT,
ACTION_LEDS_BRIGHT,
ACTION_LEDS_DIM,
ACTION_LEDS_SINGLE,
ACTION_LEDS_PAGE,
ACTION_LEDS_FLASH
};
/* ==================================
* LED MAPPING
* ==================================*/
@ -158,74 +147,62 @@ uint8_t led_game[5] = {
47,48,51
};
//======== qmk functions =========
const uint16_t fn_actions[] = {
[ALL] = ACTION_FUNCTION(ACTION_LEDS_ALL),
[GAME] = ACTION_FUNCTION(ACTION_LEDS_GAME),
[BACKLIGHT] = ACTION_FUNCTION(ACTION_LEDS_BACKLIGHT),
[BRIGHT] = ACTION_FUNCTION(ACTION_LEDS_BRIGHT),
[DIM] = ACTION_FUNCTION(ACTION_LEDS_DIM),
[MODE_SINGLE] = ACTION_FUNCTION(ACTION_LEDS_SINGLE),
[MODE_PAGE] = ACTION_FUNCTION(ACTION_LEDS_PAGE),
[MODE_FLASH] = ACTION_FUNCTION(ACTION_LEDS_FLASH),
};
/* custom action function */
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
msg_t msg;
switch(id) {
case ACTION_LEDS_ALL:
switch(keycode) {
case LED_ALL:
if(record->event.pressed) {
led_mode_global = led_mode_global == ALL ? MODE_SINGLE : ALL;
led_mode_global = led_mode_global == MODE_ALL ? MODE_SINGLE : MODE_ALL;
msg=TOGGLE_ALL;
chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
}
break;
return false;
case ACTION_LEDS_BACKLIGHT:
case LED_BACKLIGHT:
if(record->event.pressed) {
backlight_status_global ^= 1;
msg=(backlight_status_global << 8) | TOGGLE_BACKLIGHT;
chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
}
break;
return false;
case ACTION_LEDS_GAME:
case LED_GAME:
if(record->event.pressed) {
led_mode_global = led_mode_global == GAME ? MODE_SINGLE : GAME;
led_mode_global = led_mode_global == MODE_GAME ? MODE_SINGLE : MODE_GAME;
msg=(4 << 8) | DISPLAY_PAGE;
chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
}
break;
return false;
case ACTION_LEDS_BRIGHT:
case LED_BRIGHT:
if(record->event.pressed) {
msg=(1 << 8) | STEP_BRIGHTNESS;
chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
}
break;
return false;
case ACTION_LEDS_DIM:
case LED_DIM:
if(record->event.pressed) {
msg=(0 << 8) | STEP_BRIGHTNESS;
chMBPost(&led_mailbox, msg, TIME_IMMEDIATE);
}
break;
return false;
//set led_mode for matrix_scan to toggle leds
case ACTION_LEDS_SINGLE:
case LED_SINGLE:
led_mode_global = MODE_SINGLE;
break;
case ACTION_LEDS_PAGE:
return false;
case LED_PAGE:
led_mode_global = MODE_PAGE;
break;
case ACTION_LEDS_FLASH:
return false;
case LED_FLASH:
led_mode_global = MODE_FLASH;
break;
return false;
}
return true;
}
// Runs just one time when the keyboard initializes.
@ -257,7 +234,7 @@ void matrix_scan_user(void) {
return;
}
if (led_layer_state != layer_state && led_mode_global != GAME && led_mode_global != ALL) {
if (led_layer_state != layer_state && led_mode_global != MODE_GAME && led_mode_global != MODE_ALL) {
//check mode
//Turn on layer indicator or page depending on mode
switch(led_mode_global) {

View file

@ -51,18 +51,3 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______,_______,_______, _______, _______,_______,_______, KC_HOME,_______,KC_END \
),
};
/* Give numbers some descriptive names */
#define ACTION_LEDS_ALL 1
#define ACTION_LEDS_GAME 2
const uint16_t fn_actions[] = {
[2] = ACTION_FUNCTION(ACTION_LEDS_ALL),
[3] = ACTION_FUNCTION(ACTION_LEDS_GAME),
[4] = ACTION_USAGE_CONSUMER(0x1B4),
[5] = ACTION_USAGE_CONSUMER(0x196),
[6] = ACTION_USAGE_CONSUMER(0x1A6),
[7] = ACTION_USAGE_CONSUMER(0x1A0),
};

View file

@ -16,6 +16,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
enum custom_keycodes {
AL_FILE = SAFE_RANGE,
AL_WWW,
AL_HELP,
AL_CMD
};
const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Layer 0: Default Layer
* ,---------------------------------------------------------------.
@ -45,25 +52,44 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_HOME,KC_PGDN,KC_END \
),
[2] = LAYOUT( \
KC_SLEP,KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, KC_P0, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_FN2, \
KC_TRNS,KC_TRNS,KC_FN5 ,KC_FN6 ,KC_TRNS,KC_FN7 ,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_TRNS,KC_TRNS,KC_TRNS, KC_FN3, \
KC_CAPS,KC_TRNS,KC_TRNS,KC_TRNS,KC_FN4 ,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS,\
KC_SLEP,KC_P1, KC_P2, KC_P3, KC_P4, KC_P5, KC_P6, KC_P7, KC_P8, KC_P9, KC_P0, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_NO, \
KC_TRNS,KC_TRNS,AL_WWW ,AL_HELP ,KC_TRNS,AL_CMD ,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_TRNS,KC_TRNS,KC_TRNS, KC_NO, \
KC_CAPS,KC_TRNS,KC_TRNS,KC_TRNS,AL_FILE ,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_TRNS,KC_CALC,KC_TRNS,KC_TRNS,KC_TRNS,KC_MAIL,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_TRNS,KC_TRNS,KC_TRNS \
),
};
/* Give numbers some descriptive names */
#define ACTION_LEDS_ALL 1
#define ACTION_LEDS_GAME 2
const uint16_t fn_actions[] = {
[2] = ACTION_FUNCTION(ACTION_LEDS_ALL),
[3] = ACTION_FUNCTION(ACTION_LEDS_GAME),
[4] = ACTION_USAGE_CONSUMER(0x1B4),
[5] = ACTION_USAGE_CONSUMER(0x196),
[6] = ACTION_USAGE_CONSUMER(0x1A6),
[7] = ACTION_USAGE_CONSUMER(0x1A0),
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case AL_FILE:
if (record->event.pressed) {
host_consumer_send(0x1B4); // AL File Browser
} else {
host_consumer_send(0);
}
return false;
case AL_WWW:
if (record->event.pressed) {
host_consumer_send(0x196); // AL Internet Browser
} else {
host_consumer_send(0);
}
return false;
case AL_HELP:
if (record->event.pressed) {
host_consumer_send(0x1A6); // AL Integrated Help Center
} else {
host_consumer_send(0);
}
return false;
case AL_CMD:
if (record->event.pressed) {
host_consumer_send(0x1A0); // AL Command Line Processor/Run
} else {
host_consumer_send(0);
}
return false;
}
return true;
}

View file

@ -215,12 +215,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
const uint16_t PROGMEM fn_actions[] = {
[BASE] = ACTION_FUNCTION(BASE),
[PMQ] = ACTION_FUNCTION(PMQ),
[PMN] = ACTION_FUNCTION(PMN),
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
set_unicode_input_mode(UC_LNX);

View file

@ -9,6 +9,18 @@
#define NUMB_SYMB_MAC 3 // numbers and symbols mac
#define FUNCTION 4 // function keys
enum custom_keycodes {
TILDE_NO = SAFE_RANGE,
LESS_NO,
GRTR_NO,
CIRC_NO,
ACUT_NO,
GRV_NO,
LESS_NO_MAC,
GRTR_NO_MAC,
ACUT_NO_MAC
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer PC
@ -43,11 +55,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
NO_PLUS,
OSM(MOD_LSFT),CTL_T(KC_DOT),ALT_T(NO_MINS),
// right hand
KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT,
CIRC_NO, NO_DLR, NO_LPRN, NO_RPRN ,LESS_NO, GRTR_NO,NO_AT,
NO_QUOT, KC_J, KC_L, KC_U, KC_Y, NO_ARNG, NO_AE ,
KC_H, KC_N, KC_E, KC_I, KC_O, NO_OSTR,
NO_EQL, KC_K, KC_M, KC_RIGHT, KC_DOWN, KC_UP, NO_UNDS,
KC_LEFT, KC_ESC, KC_FN7, KC_HASH, MO(2),
KC_LEFT, KC_ESC, GRV_NO, KC_HASH, MO(2),
KC_INSERT, NO_SLSH,
KC_DEL,
KC_BSPC,KC_ENT,KC_SPC
@ -83,7 +95,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS,
KC_TRNS,GUI_T(KC_DOT) , KC_TRNS,
// right hand
KC_TRNS, S(NO_4), KC_TRNS,KC_TRNS,KC_FN8, KC_FN9,NO_QUOT,
KC_TRNS, S(NO_4), KC_TRNS,KC_TRNS,LESS_NO_MAC, GRTR_NO_MAC,NO_QUOT,
NO_LABK, 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
@ -125,7 +137,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS,
// right hand
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_FN2, KC_FN6 , KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, TILDE_NO, ACUT_NO , KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_5, KC_6, KC_7, KC_8, KC_TRNS,
KC_TRNS, KC_HOME, KC_9, KC_END, KC_PGDN, KC_PGUP, KC_TRNS,
KC_HOME, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
@ -166,7 +178,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS,
// right hand
KC_TRNS, KC_TRNS, KC_TRNS , KC_TRNS, KC_TRNS , KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_FN2, KC_FN10, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, TILDE_NO, ACUT_NO_MAC, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_5, KC_6, KC_7, KC_8, KC_TRNS,
KC_TRNS, KC_HOME, KC_9, KC_END, KC_PGDN, KC_PGUP, KC_TRNS,
KC_HOME, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
@ -217,47 +229,57 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
enum macro_id {
TILDE_NO, LESS_NO, GRTR_NO, CIRC_NO, ACUT_NO, GRV_NO, LESS_NO_MAC, GRTR_NO_MAC, ACUT_NO_MAC
};
const uint16_t PROGMEM fn_actions[] = {
[2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed.
[3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first.
[4] = ACTION_MACRO(GRTR_NO), // > completed on keypress down, to avoid shifting the next character if it is not released first.
[5] = ACTION_MACRO(CIRC_NO), // Completed ^ character, no space needed.
[6] = ACTION_MACRO(ACUT_NO), // Completed ´ character, no space needed.
[7] = ACTION_MACRO(GRV_NO), // Completed ` character, no space needed.
[8] = ACTION_MACRO(LESS_NO_MAC), // < completed on keypress down, to avoid same button problem when typing <> quickly
[9] = ACTION_MACRO(GRTR_NO_MAC), // > completed on keypress down, to avoid same button problem when typing <> quickly
[10] = ACTION_MACRO(ACUT_NO_MAC), // Completed ´ character, no space needed
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
keyevent_t event = record->event;
switch (id) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case TILDE_NO:
return (event.pressed ? MACRO( D(RALT), T(RBRC), U(RALT), T(SPC), END ) : MACRO_NONE);
case LESS_NO:
return (event.pressed ? MACRO( T(NUBS), END ) : MACRO_NONE);
case GRTR_NO:
return (event.pressed ? MACRO( D(LSFT), T(NUBS), U(LSFT), END ) : MACRO_NONE);
case CIRC_NO:
return (event.pressed ? MACRO( D(LSFT), T(RBRC), U(LSFT), T(SPC), END ) : MACRO_NONE);
case ACUT_NO:
return (event.pressed ? MACRO( D(RALT), T(EQL), U(RALT), T(SPC), END ) : MACRO_NONE);
case GRV_NO:
return (event.pressed ? MACRO( D(LSFT), T(EQL), T(SPC), U(LSFT), END ) : MACRO_NONE);
case LESS_NO_MAC:
return (event.pressed ? MACRO( T(GRV), END ) : MACRO_NONE);
case GRTR_NO_MAC:
return (event.pressed ? MACRO( D(LSFT), T(GRV), U(LSFT), END ) : MACRO_NONE);
case ACUT_NO_MAC:
return (event.pressed ? MACRO( T(EQL), T(SPC), END ) : MACRO_NONE);
if (record->event.pressed) {
tap_code16(ALGR(KC_RBRC));
tap_code(KC_SPC);
}
return false;
case LESS_NO:
if (record->event.pressed) {
tap_code(KC_NUBS);
}
return false;
case GRTR_NO:
if (record->event.pressed) {
tap_code16(S(KC_NUBS));
}
return false;
case CIRC_NO:
if (record->event.pressed) {
tap_code16(S(KC_RBRC));
tap_code(KC_SPC);
}
return false;
case ACUT_NO:
if (record->event.pressed) {
tap_code16(ALGR(KC_EQL));
tap_code(KC_SPC);
}
return false;
case GRV_NO:
if (record->event.pressed) {
SEND_STRING(SS_LSFT("= "));
}
return false;
case LESS_NO_MAC:
if (record->event.pressed) {
tap_code(KC_GRV);
}
return false;
case GRTR_NO_MAC:
if (record->event.pressed) {
tap_code16(S(KC_GRV));
}
return false;
case ACUT_NO_MAC:
if (record->event.pressed) {
tap_code(KC_EQL);
tap_code(KC_SPC);
}
return false;
}
return true;
}
return MACRO_NONE;
};

View file

@ -1,6 +1,4 @@
#include QMK_KEYBOARD_H
#include "debug.h"
#include "action_layer.h"
#include "version.h"
#define BASE 0 // default layer
@ -9,45 +7,19 @@
#define UNI 3 // unicode 1
#define UNI2 4 // unicode 2
enum macros {
RUN
};
enum function_ids {
EMOJI,
EMOJI2,
EPRM,
enum custom_keycodes {
I3_RUN = SAFE_RANGE,
VRSN,
RGB_SLD,
GO_GROUP
};
/* opt can only be 0-15 */
enum emojis {
SHRUG,
YAY,
HUG,
SMILE,
SMILE2,
HMM1,
HMM2,
BEAR1,
BEAR2,
FUU,
EGGY1,
EGGY2,
FACE1,
FACE2,
UHU,
SMRK1
};
enum emojis2 {
SMRK2,
LOVE
};
enum progmem_ids {
I3_GO_GROUP_1,
I3_GO_GROUP_2,
I3_GO_GROUP_3,
I3_GO_GROUP_4,
I3_GO_GROUP_5,
I3_GO_GROUP_6,
I3_GO_GROUP_7,
I3_GO_GROUP_8,
I3_GO_GROUP_9,
I3_GO_GROUP_10,
EMOJI_SHRUG,
EMOJI_YAY,
EMOJI_HUG,
@ -65,20 +37,7 @@ enum progmem_ids {
EMOJI_UHU,
EMOJI_SMRK1,
EMOJI_SMRK2,
EMOJI_LOVE,
F_EPRM,
F_VRSN,
F_RGB_SLD,
I3_GO_GROUP_10,
I3_GO_GROUP_1,
I3_GO_GROUP_2,
I3_GO_GROUP_3,
I3_GO_GROUP_4,
I3_GO_GROUP_5,
I3_GO_GROUP_6,
I3_GO_GROUP_7,
I3_GO_GROUP_8,
I3_GO_GROUP_9,
EMOJI_LOVE
};
// TODO: Finish the macros for i3 (Macros should potentially be own function instead to make things easier? some of them at least, f. ex. the ones that use 1-0 keys so we can have a single switch)
@ -163,7 +122,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
RGB_TOG,RGB_MOD,
F(F_RGB_SLD),
RGB_M_P,
RGB_VAD,RGB_VAI,KC_TRNS,
// right hand
KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,
@ -173,7 +132,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS,
RGB_HUD, RGB_HUI,
KC_TRNS,
F(F_EPRM), KC_DEL, KC_TRNS
EEP_RST, KC_DEL, KC_TRNS
),
/* Keymap 2: Media, mouse and navigation
*
@ -198,8 +157,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
// MEDIA , MOUSE and NAVIGATION
[MDIA] = LAYOUT_ergodox(
KC_TRNS, F(I3_GO_GROUP_1), F(I3_GO_GROUP_2), F(I3_GO_GROUP_3), F(I3_GO_GROUP_4), F(I3_GO_GROUP_5), F(I3_GO_GROUP_6),
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, M(RUN), KC_TRNS, KC_TRNS,
KC_TRNS, I3_GO_GROUP_1, I3_GO_GROUP_2, I3_GO_GROUP_3, I3_GO_GROUP_4, I3_GO_GROUP_5, I3_GO_GROUP_6,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, I3_RUN, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
@ -207,7 +166,7 @@ KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, M(RUN), KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS,
// right hand
F(I3_GO_GROUP_6), F(I3_GO_GROUP_7), F(I3_GO_GROUP_8), F(I3_GO_GROUP_9), F(I3_GO_GROUP_10), KC_TRNS, KC_TRNS,
I3_GO_GROUP_6, I3_GO_GROUP_7, I3_GO_GROUP_8, I3_GO_GROUP_9, I3_GO_GROUP_10, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_LEFT, KC_DOWN, KC_RIGHT, KC_TRNS, KC_MPLY,
KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, KC_TRNS,
@ -241,10 +200,10 @@ KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, M(RUN), KC_TRNS, KC_TRNS,
// Unicode
[UNI] = LAYOUT_ergodox(
KC_TRNS, UC(0x250c), UC(0x2510), UC(0x2514), UC(0x2518), UC(0x2502), UC(0x2500),
KC_TRNS, F(EMOJI_SHRUG), F(EMOJI_YAY), F(EMOJI_HUG), F(EMOJI_SMILE), F(EMOJI_SMILE2), KC_TRNS,
KC_TRNS, F(EMOJI_HMM1), F(EMOJI_HMM2), F(EMOJI_BEAR1), F(EMOJI_BEAR2), F(EMOJI_FUU),
KC_TRNS, F(EMOJI_EGGY1), F(EMOJI_EGGY2), F(EMOJI_FACE1), F(EMOJI_FACE2), F(EMOJI_UHU), KC_TRNS,
KC_TRNS, F(EMOJI_SMRK1), F(EMOJI_SMRK2), F(EMOJI_LOVE), F(F_VRSN),
KC_TRNS, EMOJI_SHRUG, EMOJI_YAY, EMOJI_HUG, EMOJI_SMILE, EMOJI_SMILE2, KC_TRNS,
KC_TRNS, EMOJI_HMM1, EMOJI_HMM2, EMOJI_BEAR1, EMOJI_BEAR2, EMOJI_FUU,
KC_TRNS, EMOJI_EGGY1, EMOJI_EGGY2, EMOJI_FACE1, EMOJI_FACE2, EMOJI_UHU, KC_TRNS,
KC_TRNS, EMOJI_SMRK1, EMOJI_SMRK2, EMOJI_LOVE, VRSN,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS,
@ -302,220 +261,84 @@ KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, M(RUN), KC_TRNS, KC_TRNS,
),
};
const uint16_t PROGMEM fn_actions[] = {
[EMOJI_SHRUG] = ACTION_FUNCTION_OPT(EMOJI, SHRUG),
[EMOJI_YAY] = ACTION_FUNCTION_OPT(EMOJI, YAY),
[EMOJI_HUG] = ACTION_FUNCTION_OPT(EMOJI,HUG),
[EMOJI_SMILE] = ACTION_FUNCTION_OPT(EMOJI,SMILE),
[EMOJI_SMILE2] = ACTION_FUNCTION_OPT(EMOJI,SMILE2),
[EMOJI_HMM1] = ACTION_FUNCTION_OPT(EMOJI,HMM1),
[EMOJI_HMM2] = ACTION_FUNCTION_OPT(EMOJI,HMM2),
[EMOJI_BEAR1] = ACTION_FUNCTION_OPT(EMOJI,BEAR1),
[EMOJI_BEAR2] = ACTION_FUNCTION_OPT(EMOJI,BEAR2),
[EMOJI_FUU] = ACTION_FUNCTION_OPT(EMOJI,FUU),
[EMOJI_EGGY1] = ACTION_FUNCTION_OPT(EMOJI,EGGY1),
[EMOJI_EGGY2] = ACTION_FUNCTION_OPT(EMOJI,EGGY2),
[EMOJI_FACE1] = ACTION_FUNCTION_OPT(EMOJI,FACE1),
[EMOJI_FACE2] = ACTION_FUNCTION_OPT(EMOJI,FACE2),
[EMOJI_UHU] = ACTION_FUNCTION_OPT(EMOJI,UHU),
[EMOJI_SMRK1] = ACTION_FUNCTION_OPT(EMOJI,SMRK1),
[EMOJI_SMRK2] = ACTION_FUNCTION_OPT(EMOJI2,SMRK2),
[EMOJI_LOVE] = ACTION_FUNCTION_OPT(EMOJI2,LOVE),
[F_EPRM] = ACTION_FUNCTION(EPRM),
[F_VRSN] = ACTION_FUNCTION(VRSN),
[F_RGB_SLD] = ACTION_FUNCTION(RGB_SLD),
[I3_GO_GROUP_10]= ACTION_FUNCTION_OPT(GO_GROUP,0),
[I3_GO_GROUP_1] = ACTION_FUNCTION_OPT(GO_GROUP,1),
[I3_GO_GROUP_2] = ACTION_FUNCTION_OPT(GO_GROUP,2),
[I3_GO_GROUP_3] = ACTION_FUNCTION_OPT(GO_GROUP,3),
[I3_GO_GROUP_4] = ACTION_FUNCTION_OPT(GO_GROUP,4),
[I3_GO_GROUP_5] = ACTION_FUNCTION_OPT(GO_GROUP,5),
[I3_GO_GROUP_6] = ACTION_FUNCTION_OPT(GO_GROUP,6),
[I3_GO_GROUP_7] = ACTION_FUNCTION_OPT(GO_GROUP,7),
[I3_GO_GROUP_8] = ACTION_FUNCTION_OPT(GO_GROUP,8),
[I3_GO_GROUP_9] = ACTION_FUNCTION_OPT(GO_GROUP,9),
};
#define TAP_ONCE(code) \
register_code (code); \
unregister_code (code)
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch(id) {
case EPRM:
eeconfig_init();
break;
switch (keycode) {
case I3_RUN:
tap_code16(C(KC_I));
tap_code(KC_R);
return false;
case VRSN:
SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
break;
case RGB_SLD:
#ifdef RGBLIGHT_ENABLE
rgblight_mode(1);
#endif
break;
case GO_GROUP:
register_code(KC_LCTL); TAP_ONCE(KC_I); unregister_code(KC_LCTL);
TAP_ONCE(KC_G);
if (opt == 0) {
TAP_ONCE(39);
return false;
case I3_GO_GROUP_1 ... I3_GO_GROUP_10:
tap_code16(C(KC_I));
tap_code(KC_G);
if (keycode == I3_GO_GROUP_10) {
tap_code(KC_0);
} else {
TAP_ONCE(29+opt);
tap_code(KC_1 + (keycode - I3_GO_GROUP_1));
}
break;
case EMOJI:
switch(opt) {
case SHRUG:
unicode_input_start(); register_hex(0xaf); unicode_input_finish();
TAP_ONCE (KC_BSLS);
register_code (KC_RSFT); TAP_ONCE (KC_MINS); TAP_ONCE (KC_9); unregister_code (KC_RSFT);
unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
register_code (KC_RSFT); TAP_ONCE (KC_0); TAP_ONCE (KC_MINS); unregister_code (KC_RSFT);
TAP_ONCE (KC_SLSH);
unicode_input_start (); register_hex(0xaf); unicode_input_finish();
break;
case YAY:
return false;
case EMOJI_SHRUG:
send_unicode_string("¯\\_(ツ)_/¯");
return false;
case EMOJI_YAY:
SEND_STRING("\\o/");
break;
case HUG:
unicode_input_start(); register_hex(0x0f3c); unicode_input_finish();
TAP_ONCE (KC_SPC);
unicode_input_start(); register_hex(0x3064); unicode_input_finish();
TAP_ONCE (KC_SPC);
unicode_input_start(); register_hex(0x25d5); unicode_input_finish();
unicode_input_start(); register_hex(0x005f); unicode_input_finish();
unicode_input_start(); register_hex(0x25d5); unicode_input_finish();
TAP_ONCE (KC_SPC);
unicode_input_start(); register_hex(0x0f3d); unicode_input_finish();
unicode_input_start(); register_hex(0x3064); unicode_input_finish();
break;
case SMILE:
unicode_input_start(); register_hex(0x0298); unicode_input_finish();
unicode_input_start(); register_hex(0x203f); unicode_input_finish();
unicode_input_start(); register_hex(0x0298); unicode_input_finish();
break;
case SMILE2:
unicode_input_start(); register_hex(0x0028); unicode_input_finish();
unicode_input_start(); register_hex(0x0298); unicode_input_finish();
unicode_input_start(); register_hex(0x203f); unicode_input_finish();
unicode_input_start(); register_hex(0x0298); unicode_input_finish();
unicode_input_start(); register_hex(0x0029); unicode_input_finish();
break;
case HMM1:
unicode_input_start(); register_hex(0x0ca0); unicode_input_finish();
unicode_input_start(); register_hex(0x005f); unicode_input_finish();
unicode_input_start(); register_hex(0x0ca0); unicode_input_finish();
break;
case HMM2:
unicode_input_start(); register_hex(0x0028); unicode_input_finish();
unicode_input_start(); register_hex(0x0ca0); unicode_input_finish();
unicode_input_start(); register_hex(0x005f); unicode_input_finish();
unicode_input_start(); register_hex(0x0ca0); unicode_input_finish();
unicode_input_start(); register_hex(0x0029); unicode_input_finish();
break;
case BEAR1:
unicode_input_start(); register_hex(0x0295); unicode_input_finish();
unicode_input_start(); register_hex(0x2022); unicode_input_finish();
unicode_input_start(); register_hex(0x1d25); unicode_input_finish();
unicode_input_start(); register_hex(0x2022); unicode_input_finish();
unicode_input_start(); register_hex(0x0294); unicode_input_finish();
break;
case BEAR2:
unicode_input_start(); register_hex(0x0028); unicode_input_finish();
unicode_input_start(); register_hex(0x1d54); unicode_input_finish();
unicode_input_start(); register_hex(0x1d25); unicode_input_finish();
unicode_input_start(); register_hex(0x1d54); unicode_input_finish();
unicode_input_start(); register_hex(0x0029); unicode_input_finish();
break;
case FUU:
unicode_input_start(); register_hex(0x256d); unicode_input_finish();
unicode_input_start(); register_hex(0x2229); unicode_input_finish();
unicode_input_start(); register_hex(0x256e); unicode_input_finish();
unicode_input_start(); register_hex(0x0028); unicode_input_finish();
unicode_input_start(); register_hex(0x002d); unicode_input_finish();
unicode_input_start(); register_hex(0x005f); unicode_input_finish();
unicode_input_start(); register_hex(0x002d); unicode_input_finish();
unicode_input_start(); register_hex(0x0029); unicode_input_finish();
unicode_input_start(); register_hex(0x256d); unicode_input_finish();
unicode_input_start(); register_hex(0x2229); unicode_input_finish();
unicode_input_start(); register_hex(0x256e); unicode_input_finish();
break;
case EGGY1:
unicode_input_start(); register_hex(0x0028); unicode_input_finish();
unicode_input_start(); register_hex(0x256f); unicode_input_finish();
unicode_input_start(); register_hex(0x00b0); unicode_input_finish();
unicode_input_start(); register_hex(0x25a1); unicode_input_finish();
unicode_input_start(); register_hex(0x00b0); unicode_input_finish();
unicode_input_start(); register_hex(0xff09); unicode_input_finish();
unicode_input_start(); register_hex(0x256f); unicode_input_finish();
break;
case EGGY2:
unicode_input_start(); register_hex(0x30ce); unicode_input_finish();
unicode_input_start(); register_hex(0x0028); unicode_input_finish();
unicode_input_start(); register_hex(0x0020); unicode_input_finish();
unicode_input_start(); register_hex(0x309c); unicode_input_finish();
unicode_input_start(); register_hex(0x002d); unicode_input_finish();
unicode_input_start(); register_hex(0x309c); unicode_input_finish();
unicode_input_start(); register_hex(0x30ce); unicode_input_finish();
unicode_input_start(); register_hex(0x0029); unicode_input_finish();
break;
case FACE1:
unicode_input_start(); register_hex(0x0028); unicode_input_finish();
unicode_input_start(); register_hex(0x002d); unicode_input_finish();
unicode_input_start(); register_hex(0x005f); unicode_input_finish();
unicode_input_start(); register_hex(0x002d); unicode_input_finish();
unicode_input_start(); register_hex(0x0029); unicode_input_finish();
break;
case FACE2:
unicode_input_start(); register_hex(0x0028); unicode_input_finish();
unicode_input_start(); register_hex(0x2022); unicode_input_finish();
unicode_input_start(); register_hex(0x005f); unicode_input_finish();
unicode_input_start(); register_hex(0x2022); unicode_input_finish();
unicode_input_start(); register_hex(0x0029); unicode_input_finish();
break;
case UHU:
unicode_input_start(); register_hex(0x2299); unicode_input_finish();
unicode_input_start(); register_hex(0xfe4f); unicode_input_finish();
unicode_input_start(); register_hex(0x2299); unicode_input_finish();
break;
case SMRK1:
unicode_input_start(); register_hex(0x005e); unicode_input_finish();
unicode_input_start(); register_hex(0x032e); unicode_input_finish();
unicode_input_start(); register_hex(0x005e); unicode_input_finish();
break;
}
break;
case EMOJI2:
switch(opt) {
case SMRK2:
unicode_input_start(); register_hex(0x0028); unicode_input_finish();
unicode_input_start(); register_hex(0x005e); unicode_input_finish();
unicode_input_start(); register_hex(0x032e); unicode_input_finish();
unicode_input_start(); register_hex(0x005e); unicode_input_finish();
unicode_input_start(); register_hex(0x0029); unicode_input_finish();
break;
case LOVE:
unicode_input_start(); register_hex(0x2665); unicode_input_finish();
unicode_input_start(); register_hex(0x203f); unicode_input_finish();
unicode_input_start(); register_hex(0x2665); unicode_input_finish();
break;
}
break;
return false;
case EMOJI_HUG:
send_unicode_string("༼ つ ◕_◕ ༽つ");
return false;
case EMOJI_SMILE:
send_unicode_string("ʘ‿ʘ");
return false;
case EMOJI_SMILE2:
send_unicode_string("(ʘ‿ʘ)");
return false;
case EMOJI_HMM1:
send_unicode_string("ಠ_ಠ");
return false;
case EMOJI_HMM2:
send_unicode_string("(ಠ_ಠ)");
return false;
case EMOJI_BEAR1:
send_unicode_string("ʕ•ᴥ•ʔ");
return false;
case EMOJI_BEAR2:
send_unicode_string("(ᵔᴥᵔ)");
return false;
case EMOJI_FUU:
send_unicode_string("╭∩╮(-_-)╭∩╮");
return false;
case EMOJI_EGGY1:
send_unicode_string("(╯°□°)╯");
return false;
case EMOJI_EGGY2:
send_unicode_string("( ゜-゜ノ)");
return false;
case EMOJI_FACE1:
SEND_STRING("(-_-)");
return false;
case EMOJI_FACE2:
send_unicode_string("(•_•)");
return false;
case EMOJI_UHU:
send_unicode_string("⊙﹏⊙");
return false;
case EMOJI_SMRK1:
send_unicode_string("^̮^");
return false;
case EMOJI_SMRK2:
send_unicode_string("(^̮^)");
return false;
case EMOJI_LOVE:
send_unicode_string("♥‿♥");
return false;
}
}
return true;
}
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
if (record->event.pressed) {
switch(id) {
case RUN:
return MACRO( D(LCTL), T(I), U(LCTL), T(R), END );
break;
}
}
return MACRO_NONE;
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
set_unicode_input_mode(UC_LNX);

View file

@ -1,7 +1,4 @@
#include QMK_KEYBOARD_H
#include "debug.h"
#include "action_layer.h"
#include "bootloader.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LAYOUT_ergodox( // layer 0 : default
@ -13,7 +10,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LGUI , KC_GRV,KC_LEFT,KC_RGHT,KC_LALT,
KC_NO , KC_NO ,
KC_NO ,
KC_BSPC,KC_DEL ,KC_FN23,
KC_BSPC,KC_DEL ,TO(3),
// right hand
KC_RBRC , KC_6, KC_7 , KC_8, KC_9, KC_0, KC_MINS,
KC_END , KC_Y, KC_U , KC_I, KC_O, KC_P, MT(MOD_RCTL, KC_BSLS),
@ -34,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,
KC_TRNS,
KC_TRNS,KC_TRNS,KC_FN1,
KC_TRNS,KC_TRNS,TO(0),
// right hand
KC_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS,
KC_TRNS,KC_EXLM,LSFT(KC_COMM),LSFT(KC_DOT),KC_EQL,KC_AMPR, KC_TRNS,
@ -55,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,
KC_TRNS,
KC_TRNS,KC_TRNS,KC_FN1 ,
KC_TRNS,KC_TRNS,TO(0) ,
// right hand
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS ,KC_TRNS, KC_HOME, KC_TRNS, KC_TRNS, KC_END ,KC_TRNS,
@ -68,14 +65,14 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
LAYOUT_ergodox( // layer 3 : teensy bootloader functions
// left hand
KC_FN0, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
RESET, 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_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_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,
KC_TRNS,
KC_TRNS,KC_TRNS,KC_FN1 ,
KC_TRNS,KC_TRNS,TO(0) ,
// right hand
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_TRNS,
@ -110,31 +107,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
/* id for user defined functions */
enum function_id {
TEENSY_KEY,
};
/*
* Fn action definition
*/
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_FUNCTION(TEENSY_KEY), // FN0 - Teensy key
[1] = ACTION_LAYER_SET(0, ON_PRESS),
[23] = ACTION_LAYER_SET(3, ON_PRESS),
[24] = ACTION_LAYER_SET(2, ON_PRESS),
[26] = ACTION_LAYER_SET(1, ON_PRESS),
};
void action_function(keyrecord_t *event, uint8_t id, uint8_t opt)
{
if (id == TEENSY_KEY) {
clear_keyboard();
print("\n\nJump to bootloader... ");
wait_ms(250);
bootloader_jump(); // should not return
print("not supported.\n");
}
}

View file

@ -7,6 +7,18 @@
#define BASE_MAC 1 // default layer mac
#define NUMB_FUNC 2 // numbers and function keys
enum custom_keycodes {
TILDE_NO = SAFE_RANGE,
LESS_NO,
GRTR_NO,
CIRC_NO,
ACUT_NO,
GRV_NO,
LESS_NO_MAC,
GRTR_NO_MAC,
ACUT_NO_MAC
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer PC
@ -32,16 +44,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[BASE] = LAYOUT_ergodox(
// left hand
KC_PAST, NO_LBRC, NO_RBRC, NO_LCBR, NO_RCBR, KC_FN2, TG(1),
KC_PAST, NO_LBRC, NO_RBRC, NO_LCBR, NO_RCBR, TILDE_NO, TG(1),
KC_PPLS, KC_Q, KC_W, KC_E, KC_R, KC_T, NO_DQUO,
KC_PSLS, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_PMNS, KC_Z, KC_X, KC_C, KC_V, KC_B, NO_SCLN,
ALT_T(KC_ESC), KC_EXLM , NO_QUES, NO_COLN, KC_TAB,
KC_HASH, KC_FN7,
KC_FN6,
KC_HASH, GRV_NO,
ACUT_NO,
OSM(MOD_LSFT),CTL_T(KC_DOT),GUI_T(KC_COMMA),
// right hand
KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT,
CIRC_NO, NO_DLR, NO_LPRN, NO_RPRN ,LESS_NO, GRTR_NO,NO_AT,
NO_QUOT, KC_Y, KC_U, KC_I, KC_O, KC_P, NO_ARNG,
KC_H, KC_J, KC_K, KC_L, NO_OSTR, NO_AE,
NO_EQL, KC_N, KC_M, KC_RIGHT, KC_DOWN, KC_UP, NO_BSLS,
@ -78,10 +90,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
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, ALGR(NO_BSLS),
KC_FN10,
ACUT_NO_MAC,
KC_TRNS,GUI_T(KC_DOT) , CTL_T(KC_COMMA),
// right hand
KC_TRNS, S(NO_4), KC_TRNS,KC_TRNS,KC_FN8, KC_FN9,NO_QUOT,
KC_TRNS, S(NO_4), KC_TRNS,KC_TRNS,LESS_NO_MAC, GRTR_NO_MAC,NO_QUOT,
NO_LABK, 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, S(ALGR(NO_7)),
@ -133,47 +145,57 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
enum macro_id {
TILDE_NO, LESS_NO, GRTR_NO, CIRC_NO, ACUT_NO, GRV_NO, LESS_NO_MAC, GRTR_NO_MAC, ACUT_NO_MAC
};
const uint16_t PROGMEM fn_actions[] = {
[2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed.
[3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first.
[4] = ACTION_MACRO(GRTR_NO), // > completed on keypress down, to avoid shifting the next character if it is not released first.
[5] = ACTION_MACRO(CIRC_NO), // Completed ^ character, no space needed.
[6] = ACTION_MACRO(ACUT_NO), // Completed ´ character, no space needed.
[7] = ACTION_MACRO(GRV_NO), // Completed ` character, no space needed.
[8] = ACTION_MACRO(LESS_NO_MAC), // < completed on keypress down, to avoid same button problem when typing <> quickly
[9] = ACTION_MACRO(GRTR_NO_MAC), // > completed on keypress down, to avoid same button problem when typing <> quickly
[10] = ACTION_MACRO(ACUT_NO_MAC), // Completed ´ character, no space needed
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
keyevent_t event = record->event;
switch (id) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case TILDE_NO:
return (event.pressed ? MACRO( D(RALT), T(RBRC), U(RALT), T(SPC), END ) : MACRO_NONE);
case LESS_NO:
return (event.pressed ? MACRO( T(NUBS), END ) : MACRO_NONE);
case GRTR_NO:
return (event.pressed ? MACRO( D(LSFT), T(NUBS), U(LSFT), END ) : MACRO_NONE);
case CIRC_NO:
return (event.pressed ? MACRO( D(LSFT), T(RBRC), U(LSFT), T(SPC), END ) : MACRO_NONE);
case ACUT_NO:
return (event.pressed ? MACRO( D(RALT), T(EQL), U(RALT), T(SPC), END ) : MACRO_NONE);
case GRV_NO:
return (event.pressed ? MACRO( D(LSFT), T(EQL), T(SPC), U(LSFT), END ) : MACRO_NONE);
case LESS_NO_MAC:
return (event.pressed ? MACRO( T(GRV), END ) : MACRO_NONE);
case GRTR_NO_MAC:
return (event.pressed ? MACRO( D(LSFT), T(GRV), U(LSFT), END ) : MACRO_NONE);
case ACUT_NO_MAC:
return (event.pressed ? MACRO( T(EQL), T(SPC), END ) : MACRO_NONE);
if (record->event.pressed) {
tap_code16(ALGR(KC_RBRC));
tap_code(KC_SPC);
}
return false;
case LESS_NO:
if (record->event.pressed) {
tap_code(KC_NUBS);
}
return false;
case GRTR_NO:
if (record->event.pressed) {
tap_code16(S(KC_NUBS));
}
return false;
case CIRC_NO:
if (record->event.pressed) {
tap_code16(S(KC_RBRC));
tap_code(KC_SPC);
}
return false;
case ACUT_NO:
if (record->event.pressed) {
tap_code16(ALGR(KC_EQL));
tap_code(KC_SPC);
}
return false;
case GRV_NO:
if (record->event.pressed) {
SEND_STRING(SS_LSFT("= "));
}
return false;
case LESS_NO_MAC:
if (record->event.pressed) {
tap_code(KC_GRV);
}
return false;
case GRTR_NO_MAC:
if (record->event.pressed) {
tap_code16(S(KC_GRV));
}
return false;
case ACUT_NO_MAC:
if (record->event.pressed) {
tap_code(KC_EQL);
tap_code(KC_SPC);
}
return false;
}
return true;
}
return MACRO_NONE;
};

View file

@ -7,6 +7,18 @@
#define BASE_MAC 1 // default layer mac
#define NUMB_FUNC 2 // numbers and function keys
enum custom_keycodes {
TILDE_NO = SAFE_RANGE,
LESS_NO,
GRTR_NO,
CIRC_NO,
ACUT_NO,
GRV_NO,
LESS_NO_MAC,
GRTR_NO_MAC,
ACUT_NO_MAC
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer PC
@ -32,16 +44,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[BASE] = LAYOUT_ergodox(
// left hand
KC_PAST, NO_LBRC, NO_RBRC, NO_LCBR, NO_RCBR, KC_FN2, TG(1),
KC_PAST, NO_LBRC, NO_RBRC, NO_LCBR, NO_RCBR, TILDE_NO, TG(1),
KC_PPLS, KC_Q, KC_W, KC_F, KC_P, KC_G, NO_DQUO,
KC_PSLS, KC_A, KC_R, KC_S, KC_T, KC_D,
KC_PMNS, KC_Z, KC_X, KC_C, KC_V, KC_B, NO_SCLN,
ALT_T(KC_ESC), KC_EXLM , NO_QUES, NO_COLN, KC_TAB,
KC_HASH, KC_FN7,
KC_FN6,
KC_HASH, GRV_NO,
ACUT_NO,
OSM(MOD_LSFT),CTL_T(KC_DOT),GUI_T(KC_COMMA),
// right hand
KC_FN5, NO_DLR, NO_LPRN, NO_RPRN ,KC_FN3, KC_FN4,NO_AT,
CIRC_NO, NO_DLR, NO_LPRN, NO_RPRN ,LESS_NO, GRTR_NO,NO_AT,
NO_QUOT, KC_J, KC_L, KC_U, KC_Y, NO_ARNG, NO_AE ,
KC_H, KC_N, KC_E, KC_I, KC_O, NO_OSTR,
NO_EQL, KC_K, KC_M, KC_RIGHT, KC_DOWN, KC_UP, NO_BSLS,
@ -78,10 +90,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
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, ALGR(NO_BSLS),
KC_FN10,
ACUT_NO_MAC,
KC_TRNS,GUI_T(KC_DOT) , CTL_T(KC_COMMA),
// right hand
KC_TRNS, S(NO_4), KC_TRNS,KC_TRNS,KC_FN8, KC_FN9,NO_QUOT,
KC_TRNS, S(NO_4), KC_TRNS,KC_TRNS,LESS_NO_MAC, GRTR_NO_MAC,NO_QUOT,
NO_LABK, 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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, S(ALGR(NO_7)),
@ -133,47 +145,57 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
enum macro_id {
TILDE_NO, LESS_NO, GRTR_NO, CIRC_NO, ACUT_NO, GRV_NO, LESS_NO_MAC, GRTR_NO_MAC, ACUT_NO_MAC
};
const uint16_t PROGMEM fn_actions[] = {
[2] = ACTION_MACRO(TILDE_NO), // Completed ~ character(pc and mac), no space needed.
[3] = ACTION_MACRO(LESS_NO), // < completed on keypress down, to avoid shifting the next character if it is not released first.
[4] = ACTION_MACRO(GRTR_NO), // > completed on keypress down, to avoid shifting the next character if it is not released first.
[5] = ACTION_MACRO(CIRC_NO), // Completed ^ character, no space needed.
[6] = ACTION_MACRO(ACUT_NO), // Completed ´ character, no space needed.
[7] = ACTION_MACRO(GRV_NO), // Completed ` character, no space needed.
[8] = ACTION_MACRO(LESS_NO_MAC), // < completed on keypress down, to avoid same button problem when typing <> quickly
[9] = ACTION_MACRO(GRTR_NO_MAC), // > completed on keypress down, to avoid same button problem when typing <> quickly
[10] = ACTION_MACRO(ACUT_NO_MAC), // Completed ´ character, no space needed
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
keyevent_t event = record->event;
switch (id) {
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case TILDE_NO:
return (event.pressed ? MACRO( D(RALT), T(RBRC), U(RALT), T(SPC), END ) : MACRO_NONE);
case LESS_NO:
return (event.pressed ? MACRO( T(NUBS), END ) : MACRO_NONE);
case GRTR_NO:
return (event.pressed ? MACRO( D(LSFT), T(NUBS), U(LSFT), END ) : MACRO_NONE);
case CIRC_NO:
return (event.pressed ? MACRO( D(LSFT), T(RBRC), U(LSFT), T(SPC), END ) : MACRO_NONE);
case ACUT_NO:
return (event.pressed ? MACRO( D(RALT), T(EQL), U(RALT), T(SPC), END ) : MACRO_NONE);
case GRV_NO:
return (event.pressed ? MACRO( D(LSFT), T(EQL), T(SPC), U(LSFT), END ) : MACRO_NONE);
case LESS_NO_MAC:
return (event.pressed ? MACRO( T(GRV), END ) : MACRO_NONE);
case GRTR_NO_MAC:
return (event.pressed ? MACRO( D(LSFT), T(GRV), U(LSFT), END ) : MACRO_NONE);
case ACUT_NO_MAC:
return (event.pressed ? MACRO( T(EQL), T(SPC), END ) : MACRO_NONE);
if (record->event.pressed) {
tap_code16(ALGR(KC_RBRC));
tap_code(KC_SPC);
}
return false;
case LESS_NO:
if (record->event.pressed) {
tap_code(KC_NUBS);
}
return false;
case GRTR_NO:
if (record->event.pressed) {
tap_code16(S(KC_NUBS));
}
return false;
case CIRC_NO:
if (record->event.pressed) {
tap_code16(S(KC_RBRC));
tap_code(KC_SPC);
}
return false;
case ACUT_NO:
if (record->event.pressed) {
tap_code16(ALGR(KC_EQL));
tap_code(KC_SPC);
}
return false;
case GRV_NO:
if (record->event.pressed) {
SEND_STRING(SS_LSFT("= "));
}
return false;
case LESS_NO_MAC:
if (record->event.pressed) {
tap_code(KC_GRV);
}
return false;
case GRTR_NO_MAC:
if (record->event.pressed) {
tap_code16(S(KC_GRV));
}
return false;
case ACUT_NO_MAC:
if (record->event.pressed) {
tap_code(KC_EQL);
tap_code(KC_SPC);
}
return false;
}
return true;
}
return MACRO_NONE;
};

View file

@ -49,7 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
M(KC_CAPS), M(KC_A), M(KC_S), M(KC_D), M(KC_F), M(KC_G),
KC_LSFT, M(KC_Z), M(KC_X), M(KC_C), M(KC_V), M(KC_B), MO(SYMB),
KC_LCTL, KC_LALT, KC_LGUI, KC_LEFT, KC_RGHT,
KC_TRNS, KC_FN1,
KC_TRNS, F(1),
KC_HOME,
KC_BSPC, KC_DEL, KC_END,
// right hand
@ -91,7 +91,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
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_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_FN3, KC_FN2,
F(3), F(2),
KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,
// right hand
@ -132,7 +132,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,
KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO,
KC_FN4, KC_NO,
F(4), KC_NO,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS,
// right hand

View file

@ -55,7 +55,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
TG(1), KC_J, KC_F, KC_U, KC_P, KC_SCLN, KC_BSLS,
KC_Y, KC_N, KC_E, KC_O, KC_I, KC_QUOT,
MEH_T(KC_NO),KC_K, KC_L, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
KC_LEFT,KC_DOWN,KC_UP, KC_RGHT, KC_FN4,
KC_LEFT,KC_DOWN,KC_UP, KC_RGHT, F(4),
KC_NO, KC_NO,
KC_PGUP,
KC_PGDN,KC_SPC,KC_ENT