1
0
Fork 0

added a lock screen key

This commit is contained in:
Callum Oakley 2016-08-12 21:05:52 +01:00
parent 49fbcb3e7c
commit 993d72b11f

View file

@ -20,7 +20,8 @@ enum planck_keycodes {
BASE = SAFE_RANGE,
MOVE,
SYMB,
FUNC
FUNC,
LOCK
};
// Fillers to make layering more clear
@ -87,7 +88,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* ,-----------------------------------------------------------------------------------.
* | F12 | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 |
* |-----------------------------------------------------------------------------------.
* | | Play | Prev | Next | BL+ | | | | | | | |
* | | Play | Prev | Next | BL+ | | | Lock | | | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | Mute | Vol- | Vol+ | BL- | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
@ -96,7 +97,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
[_FUNC] = {
{KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11 },
{_______, KC_MPLY, KC_MPRV, KC_MNXT, KC_PAUS, _______, _______, _______, _______, _______, _______, _______},
{_______, KC_MPLY, KC_MPRV, KC_MNXT, KC_PAUS, _______, _______, LOCK, _______, _______, _______, _______},
{_______, KC_MUTE, KC_VOLD, KC_VOLU, KC_SLCK, _______, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET }
}
@ -133,6 +134,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
break;
case LOCK:
if (record->event.pressed) {
register_code(KC_RSFT);
register_code(KC_RGUI);
register_code(KC_POWER);
} else {
unregister_code(KC_POWER);
unregister_code(KC_RGUI);
unregister_code(KC_RSFT);
}
return false;
break;
}
return true;
}