From 993d72b11fca8d50296570dc85e9354f8045c4a6 Mon Sep 17 00:00:00 2001 From: Callum Oakley Date: Fri, 12 Aug 2016 21:05:52 +0100 Subject: [PATCH] added a lock screen key --- keyboards/planck/keymaps/callum/keymap.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/keyboards/planck/keymaps/callum/keymap.c b/keyboards/planck/keymaps/callum/keymap.c index ed187df1d..494ed30b0 100644 --- a/keyboards/planck/keymaps/callum/keymap.c +++ b/keyboards/planck/keymaps/callum/keymap.c @@ -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; } -- 2.39.2