1
0
Fork 0
forked from forks/qmk_firmware

Activate SYS layer by pressing both Ctrls

This commit is contained in:
Priyadi Iman Nurcahyo 2017-02-10 17:11:52 +07:00
parent 4ffbfe8298
commit a5b8db52a0

View file

@ -782,8 +782,8 @@ void persistant_default_layer_set(uint16_t default_layer) {
} }
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
bool lshifted = keyboard_report->mods & MOD_BIT(KC_LSFT); bool lshift = keyboard_report->mods & MOD_BIT(KC_LSFT);
bool rshifted = keyboard_report->mods & MOD_BIT(KC_RSFT); bool rshift = keyboard_report->mods & MOD_BIT(KC_RSFT);
switch (keycode) { switch (keycode) {
// handle greek layer shift // handle greek layer shift
@ -796,7 +796,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_on(_GREEKU); layer_on(_GREEKU);
layer_off(_GREEKL); layer_off(_GREEKL);
} else { } else {
if (lshifted ^ rshifted) { // if only one shift was pressed if (lshift ^ rshift) { // if only one shift was pressed
layer_on(_GREEKL); layer_on(_GREEKL);
layer_off(_GREEKU); layer_off(_GREEKU);
} }
@ -805,16 +805,32 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true; return true;
break; break;
// press both ctrls to activate SYS layer
case KC_LCTL:
case KC_RCTL:
;
bool lctrl = keyboard_report->mods & MOD_BIT(KC_LCTL);
bool rctrl = keyboard_report->mods & MOD_BIT(KC_RCTL);
if (record->event.pressed) {
if (lctrl ^ rctrl) { // if only one ctrl was pressed
layer_on(_SYS);
}
} else {
layer_off(_SYS);
}
return true;
break;
// QWERTZ style comma and dot: semicolon and colon when shifted // QWERTZ style comma and dot: semicolon and colon when shifted
case KC_COMM: case KC_COMM:
if (record->event.pressed) { if (record->event.pressed) {
if (lshifted || rshifted) { if (lshift || rshift) {
if (lshifted) unregister_code(KC_LSFT); if (lshift) unregister_code(KC_LSFT);
if (rshifted) unregister_code(KC_RSFT); if (rshift) unregister_code(KC_RSFT);
register_code(KC_SCLN); register_code(KC_SCLN);
unregister_code(KC_SCLN); unregister_code(KC_SCLN);
if (lshifted) register_code(KC_LSFT); if (lshift) register_code(KC_LSFT);
if (rshifted) register_code(KC_RSFT); if (rshift) register_code(KC_RSFT);
} else { } else {
register_code(KC_COMM); register_code(KC_COMM);
unregister_code(KC_COMM); unregister_code(KC_COMM);
@ -891,7 +907,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
case GREEK: case GREEK:
if (record->event.pressed) { if (record->event.pressed) {
if (lshifted || rshifted) { if (lshift || rshift) {
layer_on(_GREEKU); layer_on(_GREEKU);
layer_off(_GREEKL); layer_off(_GREEKL);
} else { } else {