Skip to content

Commit

Permalink
Add keycodes: UNICODE_MODE_FORWARD, UNICODE_MODE_REVERSE
Browse files Browse the repository at this point in the history
Aliases: UC_MOD, UC_RMOD (respectively)
  • Loading branch information
Konstantin Đorđević committed Nov 5, 2018
1 parent 1a19eb7 commit f4ded78
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
9 changes: 2 additions & 7 deletions keyboards/whitefox/keymaps/konstantin/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ enum layers {

enum custom_keycodes {
CLEAR = SAFE_RANGE,
CYCLEUC,
NUMPAD,
};

Expand All @@ -37,10 +36,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) { SEND_STRING(SS_LCTRL("a") SS_TAP(X_DELETE)); }
return false;

case CYCLEUC:
if (record->event.pressed) { cycle_unicode_input_mode(+1); }
return false;

case NUMPAD:
if (record->event.pressed) {
layer_invert(L_NUMPAD);
Expand Down Expand Up @@ -105,7 +100,7 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* ,---------------------------------------------------------------.
* | |F1 |F2 |F3 |F4 |F5 |F6 |F7 |F8 |F9 |F10|F11|F12|Num|Scr|Pau|
* |---------------------------------------------------------------|
* | M4 |M2 |M↑ |M1 |M3 |M5 | |Cyc| |Stp|Ply|Prv|Nxt|Clear|Ins|
* | M4 |M2 |M↑ |M1 |M3 |M5 | |UCM| |Stp|Ply|Prv|Nxt|Clear|Ins|
* |---------------------------------------------------------------|
* | |M← |M↓ |M→ |MW↑| | | | | | | | |Top|
* |---------------------------------------------------------------|
Expand All @@ -116,7 +111,7 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[L_FN] = LAYOUT_truefox( \
_______,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, NUMPAD, KC_SLCK,KC_PAUS, \
KC_BTN4,KC_BTN2,KC_MS_U,KC_BTN1,KC_BTN3,KC_BTN5,_______,CYCLEUC,_______,KC_MSTP,KC_MPLY,KC_MPRV,KC_MNXT,CLEAR, KC_INS, \
KC_BTN4,KC_BTN2,KC_MS_U,KC_BTN1,KC_BTN3,KC_BTN5,_______,UC_MOD, _______,KC_MSTP,KC_MPLY,KC_MPRV,KC_MNXT,CLEAR, KC_INS, \
_______,KC_MS_L,KC_MS_D,KC_MS_R,KC_WH_U,_______,_______,_______,_______,_______,_______,_______, _______, TOP, \
_______, KC_ACL0,KC_ACL2,KC_WH_L,KC_WH_R,_______,_______,_______,KC_VOLD,KC_VOLU,KC_MUTE,KC_APP, KC_PGUP,BOTTOM, \
_______,DESKTOP,DESKT_L, KC_WH_D, DESKT_R,_______, KC_HOME,KC_PGDN,KC_END \
Expand Down
6 changes: 6 additions & 0 deletions quantum/process_keycode/process_unicode_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ void send_unicode_hex_string(const char *str) {
bool process_unicode_common(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch (keycode) {
case UNICODE_MODE_FORWARD:
cycle_unicode_input_mode(+1);
break;
case UNICODE_MODE_BACKWARD:
cycle_unicode_input_mode(-1);
break;
case UNICODE_MODE_OSX:
set_unicode_input_mode(UC_OSX);
#if defined(AUDIO_ENABLE) && defined(UNICODE_SONG_OSX)
Expand Down
4 changes: 4 additions & 0 deletions quantum/quantum_keycodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ enum quantum_keycodes {
TERM_OFF,
#endif

UNICODE_MODE_FORWARD,
UNICODE_MODE_REVERSE,
UNICODE_MODE_OSX,
UNICODE_MODE_LNX,
UNICODE_MODE_WIN,
Expand Down Expand Up @@ -685,6 +687,8 @@ enum quantum_keycodes {
#define X(n) (QK_UNICODE_MAP | (n))
#endif

#define UC_MOD UNICODE_MODE_FORWARD
#define UC_RMOD UNICODE_MODE_REVERSE
#define UC_M_OS UNICODE_MODE_OSX
#define UC_M_LN UNICODE_MODE_LNX
#define UC_M_WI UNICODE_MODE_WIN
Expand Down

0 comments on commit f4ded78

Please sign in to comment.