Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various keymap updates #1118

Merged
merged 10 commits into from
Feb 23, 2017
2 changes: 1 addition & 1 deletion keyboards/handwired/promethium/keymaps/priyadi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Main layer modifications from default Planck layout:
* Lower & Raise is now called Num and Fun.
* OS & Left keys become another thumb modifier: Empty & Greek (Empty because I used this for another use and my muscle memory is not adapted to it yet)

On Promethium, Trackpoint is enabled on PD2 and PD2. We impersonate a Thinkpad keyboard to be able to use Thinkpad driver on Windows (still needs verification).
On Promethium, Trackpoint is enabled on PD2 and PD3. We impersonate a Thinkpad keyboard to be able to use Thinkpad driver on Windows (still needs verification).

AltGr & Compose dual use key. Tap for Compose (mapped to Scroll Lock in hardware) and press for AltGr.

Expand Down
57 changes: 32 additions & 25 deletions keyboards/handwired/promethium/keymaps/priyadi/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define KC_WWWF KC_WWW_FORWARD

// hybrid right-alt & scroll lock (mapped to Compose in OS)
#undef KC_RALT
#define KC_RALT MT(MOD_RALT, KC_SLCK)
#define C_RALT MT(MOD_RALT, KC_SLCK)

// dual use right-shift & del key
// #define C_RSFT MT(MOD_RSFT, KC_DEL)

bool capslock = false;
#ifdef DOUBLESPACE_LAYER_ENABLE
Expand Down Expand Up @@ -572,7 +574,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_QUOT, KC_ENT ,
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_LCTL, KC_LALT, KC_LGUI, EMPTY, NUM, LSPACE, RSPACE, FUN, GREEK, KC_RGUI, KC_RALT, KC_RCTL
KC_LCTL, KC_LALT, KC_LGUI, EMPTY, NUM, LSPACE, RSPACE, FUN, GREEK, KC_RGUI, C_RALT, KC_RCTL
),

/* Dvorak
Expand Down Expand Up @@ -664,16 +666,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | * | \ | - | = | / | ≠ | ( | ) | < | > | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | & | ^ | | | _ | + | ? | ± | [ | ] | { | } | : |
* | & | ^ | | | _ | + | ? | ± | [ | ] | { | } | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* | | | | | | | | | | : | |
* `-----------------------------------------------------------------------------------'
*/
[_PUNC] = KEYMAP(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, X(LTEQ), X(GTEQ), _______,
KC_GRV, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, X(NOTEQ),KC_LPRN, KC_RPRN, KC_LABK, KC_RABK, _______,
KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, X(PLMIN),KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, KC_COLN,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, X(PLMIN),KC_LBRC, KC_RBRC, KC_LCBR, KC_RCBR, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_COLN, _______
),

/* Num
Expand All @@ -682,33 +684,33 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | ` | * | \ | - | = | / | B | 4 | 5 | 6 | E | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | & | ^ | | | _ | + | ? | C | 1 | 2 | 3 | F | : |
* | & | ^ | | | _ | + | ? | C | 1 | 2 | 3 | F | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | 0 | , | . | x | |
* | | | x | | | | | 0 | , | . | : | |
* `-----------------------------------------------------------------------------------'
*/
[_NUM] = KEYMAP(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, S(KC_A), KC_7, KC_8, KC_9, S(KC_D), _______,
KC_GRV, KC_ASTR, KC_BSLS, KC_MINS, KC_EQL, KC_SLSH, S(KC_B), KC_4, KC_5, KC_6, S(KC_E), _______,
KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, S(KC_C), KC_1, KC_2, KC_3, S(KC_F), KC_COLN,
_______, _______, _______, _______, _______, _______, _______, FUN0 , KC_COMM, KC_DOT, KC_X, _______
KC_AMPR, KC_CIRC, KC_PIPE, KC_UNDS, KC_PLUS, KC_QUES, S(KC_C), KC_1, KC_2, KC_3, S(KC_F), _______,
_______, _______, KC_X, _______, _______, _______, _______, FUN0 , KC_COMM, KC_DOT, KC_COLN, _______
),

/* Func
* ,-----------------------------------------------------------------------------------.
* | | F1 | F2 | F3 | F4 | | | PgUp | Up | PgDn | PgUp | Del |
* | | F1 | F2 | F3 | F4 | Ins | | PgUp | Up | PgDn | PgUp | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | F5 | F6 | F7 | F8 |PrtSc | | Left | Down | Right| PgDn | Ins |
* | Caps | F5 | F6 | F7 | F8 |PrtSc | | Left | Down | Right| PgDn | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F9 | F10 | F11 | F12 | | | | Home | End | | |
* | | F9 | F10 | F11 | F12 |Pause | | | Home | End | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_FUN] = KEYMAP(
XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, KC_PGUP, KC_UP, KC_PGDN, KC_PGUP, KC_DEL,
XXXXXXX, KC_F5, KC_F6, KC_F7, KC_F8, KC_PSCR, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_INS,
_______, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_END, XXXXXXX, _______,
XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, KC_INS, XXXXXXX, KC_PGUP, KC_UP, KC_PGDN, KC_PGUP, KC_DEL,
KC_CAPS, KC_F5, KC_F6, KC_F7, KC_F8, KC_PSCR, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, _______,
_______, KC_F9, KC_F10, KC_F11, KC_F12, KC_PAUS, XXXXXXX, XXXXXXX, KC_HOME, KC_END, XXXXXXX, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),

Expand Down Expand Up @@ -933,7 +935,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif

// handle greek layer shift
// handle both shift = capslock
case KC_LSFT:
case KC_RSFT:
;
Expand All @@ -947,13 +948,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
layer_off(_GREEKU);
}
}
} else {
if (record->event.pressed) {
if (lshift ^ rshift) { // if only one shift was pressed
register_code(KC_CAPS);
unregister_code(KC_CAPS);
}
}
}
return true;
break;
Expand Down Expand Up @@ -1044,6 +1038,19 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
#endif

// only process Fnumber on key release, and only when layer switcher is still pressed.
// this is to avoid accidental presses on potentially destructive keys
case KC_F1 ... KC_F12:
case KC_PAUS:
case KC_PSCR:
case KC_INS:
if (!record->event.pressed && layer == _FUN) { // key released and still in FUN layer
register_code(keycode);
unregister_code(keycode);
}
return false;
break;

// layer switcher
//
case GREEK:
Expand Down
10 changes: 6 additions & 4 deletions quantum/process_keycode/process_unicodemap.c
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
#include "process_unicodemap.h"
#include "process_unicode_common.h"

__attribute__((weak))
const uint32_t PROGMEM unicode_map[] = {
};

void register_hex32(uint32_t hex) {
uint8_t onzerostart = 1;
bool onzerostart = true;
for(int i = 7; i >= 0; i--) {
if (i <= 3) {
onzerostart = 0;
onzerostart = false;
}
uint8_t digit = ((hex >> (i*4)) & 0xF);
if (digit == 0) {
if (onzerostart == 0) {
if (!onzerostart) {
register_code(hex_to_keycode(digit));
unregister_code(hex_to_keycode(digit));
}
} else {
register_code(hex_to_keycode(digit));
unregister_code(hex_to_keycode(digit));
onzerostart = 0;
onzerostart = false;
}
}
}
Expand All @@ -28,6 +29,7 @@ __attribute__((weak))
void unicode_map_input_error() {}

bool process_unicode_map(uint16_t keycode, keyrecord_t *record) {
uint8_t input_mode = get_unicode_input_mode();
if ((keycode & QK_UNICODE_MAP) == QK_UNICODE_MAP && record->event.pressed) {
const uint32_t* map = unicode_map;
uint16_t index = keycode - QK_UNICODE_MAP;
Expand Down