qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

keymap.c (4917B)


      1 /* Copyright 2019 John M Daly <jmdaly@gmail.com>
      2  *
      3  * This program is free software: you can redistribute it and/or modify
      4  * it under the terms of the GNU General Public License as published by
      5  * the Free Software Foundation, either version 2 of the License, or
      6  * (at your option) any later version.
      7  *
      8  * This program is distributed in the hope that it will be useful,
      9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11  * GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License
     14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
     15  */
     16 #include QMK_KEYBOARD_H
     17 
     18 enum co60_layers {
     19   _L1,
     20   _L2,
     21   _L3
     22 };
     23 
     24 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     25   // Default base layer. Except for the bottom row, this
     26   // is close to a standard HHKB layout.
     27   [_L1] = LAYOUT_60_hhkb_split_625u_space( /* Base */
     28     KC_ESC,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7, KC_8,    KC_9,    KC_0,    KC_MINS,    KC_EQL,  KC_BSLS, KC_GRV,
     29     KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U, KC_I,    KC_O,    KC_P,    KC_LBRC,    KC_RBRC, KC_BSPC,
     30     CTL_T(KC_ESC), KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J, KC_K,    KC_L,    KC_SCLN, KC_QUOT,    KC_ENT,
     31     SC_LSPO, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M, KC_COMM, KC_DOT,  KC_SLSH, SC_RSPC, MO(_L3),
     32              KC_LALT, KC_LGUI,       KC_ENT,              MO(_L3),       KC_SPC,  QK_LEAD, KC_RGUI, KC_RALT
     33   ),
     34   // My preferred base layout. This doesn't match the caps
     35   // on my boards, so I don't make it default.
     36   [_L2] = LAYOUT_60_hhkb_split_625u_space( /* Base */
     37     KC_GRV,  KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7, KC_8,    KC_9,    KC_0,    KC_MINS,    KC_EQL,  KC_BSLS, KC_DEL,
     38     KC_TAB,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U, KC_I,    KC_O,    KC_P,    KC_LBRC,    KC_RBRC, KC_BSPC,
     39     CTL_T(KC_ESC), KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J, KC_K,    KC_L,    KC_SCLN, KC_QUOT,    KC_ENT,
     40     SC_LSPO, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M, KC_COMM, KC_DOT,  KC_SLSH, SC_RSPC, MO(_L3),
     41              KC_LALT, KC_LGUI,       KC_ENT,              MO(_L3),       KC_SPC,  QK_LEAD, KC_RGUI, KC_RALT
     42   ),
     43   [_L3] = LAYOUT_60_hhkb_split_625u_space( /* Function */
     44     QK_BOOT, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,     KC_F10,    KC_F11,     KC_F12,   _______, _______,
     45     BL_BRTG, BL_TOGG, BL_UP,   BL_DOWN,BL_ON, BL_OFF, _______, _______, _______, _______,   _______,   KC_PGUP,    KC_INSERT,  KC_DEL,
     46     _______, UG_TOGG, UG_NEXT, UG_PREV, _______, _______, KC_LEFT, KC_DOWN, KC_UP,   KC_RIGHT,  KC_HOME,   KC_END,     _______,
     47     _______, BL_DOWN, _______, _______, _______, _______, _______, DF(_L1), DF(_L2), _______,   KC_PGDN,   _______, _______,
     48              _______, _______,          _______,          _______,          _______, _______,   _______,   _______
     49   )
     50 };
     51 
     52 void leader_end_user() {
     53   // Close a program in i3wm
     54   if (leader_sequence_one_key(KC_Q)) {
     55     register_code(KC_LGUI);
     56     register_code(KC_LSFT);
     57     register_code(KC_Q);
     58     unregister_code(KC_Q);
     59     unregister_code(KC_LSFT);
     60     unregister_code(KC_LGUI);
     61   }
     62   // Exit i3wm
     63   if (leader_sequence_one_key(KC_E)) {
     64     register_code(KC_LGUI);
     65     register_code(KC_LSFT);
     66     register_code(KC_E);
     67     unregister_code(KC_E);
     68     unregister_code(KC_LSFT);
     69     unregister_code(KC_LGUI);
     70   }
     71   // Copy selected text in suckless terminal
     72   if (leader_sequence_one_key(KC_C)) {
     73     register_code(KC_LCTL);
     74     register_code(KC_LSFT);
     75     register_code(KC_C);
     76     unregister_code(KC_C);
     77     unregister_code(KC_LSFT);
     78     unregister_code(KC_LCTL);
     79   }
     80   // Paste text in suckless terminal
     81   if (leader_sequence_one_key(KC_V)) {
     82     register_code(KC_LCTL);
     83     register_code(KC_LSFT);
     84     register_code(KC_V);
     85     unregister_code(KC_V);
     86     unregister_code(KC_LSFT);
     87     unregister_code(KC_LCTL);
     88   }
     89   // FZF shortcut to fuzzy switch directories
     90   if (leader_sequence_one_key(KC_D)) {
     91     register_code(KC_LALT);
     92     register_code(KC_C);
     93     unregister_code(KC_C);
     94     unregister_code(KC_LALT);
     95   }
     96   // Send keys to bring up fuzzy process kill
     97   if (leader_sequence_one_key(KC_K)) {
     98     SEND_STRING("kill " SS_TAP(X_TAB));
     99   }
    100   // Send keys to start neovim and fuzzy search for filename
    101   if (leader_sequence_one_key(KC_T)) {
    102     SEND_STRING("nvim ");
    103     register_code(KC_LCTL);
    104     register_code(KC_T);
    105     unregister_code(KC_T);
    106     unregister_code(KC_LCTL);
    107   }
    108   // Switch between windows in tmux
    109   if (leader_sequence_one_key(KC_L)) {
    110     register_code(KC_LCTL);
    111     register_code(KC_B);
    112     unregister_code(KC_B);
    113     unregister_code(KC_LCTL);
    114     register_code(KC_L);
    115     unregister_code(KC_L);
    116   }
    117 }