Skip to content

Commit

Permalink
Adding default keymap
Browse files Browse the repository at this point in the history
  • Loading branch information
4sStylZ committed Sep 13, 2019
1 parent c135dd8 commit 5d6ff86
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 87 deletions.
102 changes: 102 additions & 0 deletions keyboards/handwired/aek64/keymaps/4sstylz/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#include QMK_KEYBOARD_H

// Implement Super-alt↯tab
// See https://docs.qmk.fm/#/feature_macros?id=super-alt↯tab
bool is_alt_tab_active = false;
uint16_t alt_tab_timer = 0;

// Defining all the custom keycodes.
enum custom_keycodes {
ALT_TAB = SAFE_RANGE
};

const uint16_t PROGMEM lock_combo[] = {KC_J, KC_K, KC_L, KC_SCLN, COMBO_END};
combo_t key_combos[COMBO_COUNT] = {COMBO(lock_combo, LGUI(KC_O))};

// Define the keycodes for one qwerty layer and one Fn layer.
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty
* ┌──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬─────────────┐
* │ ` Esc│ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Bksp │
* ├─────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼─────┬───────┤
* │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ │
* ├─────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼─────┴┐ Enter│
* │ Layer 2 │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ # │ │
* ├──────┬──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┴──────┴──────┤
* │ Shift│ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shift │
* ├──────┼──────┼──────┼──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┼──────┬──────┬──────┤
* │ Ctrl │ Alt │↯ATab │ Space │ Gui │ Alt │ Ctrl │
* └──────┴──────┴──────┴──────────────────────────────────────────────────────────────┴──────┴──────┴──────┘
*
* Hidden features : 
* - Left Shift is also Home on a single tap.
* - Left Ctrl is also End on a single tap.
* - Right Shift is also page-up on a single tap.
* - Right Ctrl is also page-down on a single tap.
* - Press JKLM for Windows + L (Session lock)
*/
[0] = LAYOUT_qwerty( \
KC_GESC , 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_BSPC,
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,
MO(1) , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT ,
KC_LSPO , KC_NUBS, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSPC ,
KC_LCPO , KC_LALT, ALT_TAB, KC_SPC, KC_LGUI, KC_RALT, KC_RCPC
),

/* 1: second layer for media keys and many advanced features ç
* ┌──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬─────────────┐
* │Alt F4│ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │ │
* ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼─────┬───────┤
* │ │ │ │PrtScn│ Brt+ │ Brt- │Ctrl A│ Home │ Up │ End │ ‽  │ ↑     │ ⸮   │ │ │
* ├─────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼─────┴┐ │
* │ │ Cut │ Copy │Paste │ Del │ Del │ Left │ Down │Right │ ← │ ↓ │ → │ │ │
* ├──────┬──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┴──────┴──────┤
* │ │ │ Mute │ Vol- │ Vol+ │ │ │ │ │ │ │Reset │ │
* ├──────┼──────┼──────┼──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┼──────┬──────┬──────┤
* │ │ │ │ │ │ │ │
* └──────┴──────┴──────┴──────────────────────────────────────────────────────────────┴──────┴──────┴──────┘
*/
[1] = LAYOUT_qwerty( \
LALT(KC_F4), KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , _______,
_______ , _______ , _______ , KC_PSCR , KC_BRIU , KC_BRID, LCTL(KC_A), KC_HOME, KC_UP , KC_END , UC(0x203D) , UC(0x8593), UC(0x2E2E),
_______ , _______ , LSFT(KC_DEL), LCTL(KC_INS), LSFT(KC_INS), KC_DEL , KC_DEL , KC_LEFT, KC_DOWN, KC_RIGHT, UC(0x8592) , UC(0x8595), UC(0x8594), _______,
_______ , _______ , KC_MUTE , KC_VOLD , KC_VOLU , _______, _______ , _______, _______, _______ , _______ , RESET , _______ ,
_______ , _______ , _______ , _______, _______ , _______ , _______
)
};

// Set the unicode input mode for using UC.
void matrix_init_user(void) {
set_unicode_input_mode(UC_LNX);
}

// Processing all the key pressed.
// Alt+tab.
bool process_record_user(uint16_t keycode, keyrecord_t *record) {

// Depending keycodes…
switch (keycode) { // This will do most of the grunt work with the keycodes.
case ALT_TAB:
if (record->event.pressed) {
if (!is_alt_tab_active) {
is_alt_tab_active = true;
register_code(KC_LALT);
}
alt_tab_timer = timer_read();
register_code(KC_TAB);
} else {
unregister_code(KC_TAB);
}
break;
}
return true;
}

void matrix_scan_user(void) { // The very important timer.
if (is_alt_tab_active) {
if (timer_elapsed(alt_tab_timer) > 750) {
unregister_code(KC_LALT);
is_alt_tab_active = false;
}
}
}
98 changes: 12 additions & 86 deletions keyboards/handwired/aek64/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
#include QMK_KEYBOARD_H

// Implement Super-alt↯tab
// See https://docs.qmk.fm/#/feature_macros?id=super-alt↯tab
bool is_alt_tab_active = false;
uint16_t alt_tab_timer = 0;

// Defining all the custom keycodes.
enum custom_keycodes {
ALT_TAB = SAFE_RANGE
};

enum {
CT_QW
};

const uint16_t PROGMEM lock_combo[] = {KC_J, KC_K, KC_L, KC_SCLN, COMBO_END};
combo_t key_combos[COMBO_COUNT] = {COMBO(lock_combo, LGUI(KC_O))};

// Define the keycodes for one qwerty layer and one Fn layer.
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty
Expand All @@ -29,7 +12,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* ├──────┬──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┴──────┴──────┤
* │ Shift│ \ │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shift │
* ├──────┼──────┼──────┼──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┼──────┬──────┬──────┤
* │ Ctrl │ Alt │↯ATab │ Space │ Gui │ Alt │ Ctrl │
* │ Ctrl │ Alt │ Gui │ Space │ Gui │ Alt │ Ctrl │
* └──────┴──────┴──────┴──────────────────────────────────────────────────────────────┴──────┴──────┴──────┘
*
* Hidden features : 
Expand All @@ -39,89 +22,32 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* - Right Ctrl is also page-down on a single tap.
* - Press JKLM for Windows + L (Session lock)
*/
[0] = LAYOUT_qwerty( \
KC_GESC , 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_BSPC,
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,
MO(1) , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT ,
KC_LSPO , KC_NUBS, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSPC ,
KC_LCPO , KC_LALT, ALT_TAB, KC_SPC, KC_LGUI, KC_RALT, KC_RCPC
[0] = LAYOUT_qwerty(
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_BSPC,
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,
MO(1) , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L , KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT ,
KC_LSPO, KC_NUBS, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_RSPC ,
KC_LCPO, KC_LALT, KC_LGUI, KC_SPC, KC_RGUI, KC_RALT, KC_RCPC
),

/* 1: second layer for media keys and many advanced features ç
* ┌──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬─────────────┐
* │Alt F4│ F1 │ F2 │ F3 │ F4 │ F5 │ F6 │ F7 │ F8 │ F9 │ F10 │ F11 │ F12 │ │
* ├──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼─────┬───────┤
* │ │ │ │PrtScn│ Brt+ │ Brt- │Ctrl A│ Home │ Up │ End │ ‽  ↑     ⸮   │ │ │
* │ │ │ │ │ │ │Ctrl A│ Home │ Up │ End │ │ │ │
* ├─────────────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼─────┴┐ │
* │ │ Cut │ Copy │Paste │ Del │ Del │ Left │ Down │Right │ │ │ │
* │ │ Cut │ Copy │Paste │ Del │ Del │ Left │ Down │Right │ │ │ │
* ├──────┬──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┼──────┴──────┴──────┤
* │ │ │ Mute │ Vol- │ Vol+ │ │ │ │ │ │ │Reset │ │
* ├──────┼──────┼──────┼──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┼──────┬──────┬──────┤
* │ │ │ │ │ │ │ │
* └──────┴──────┴──────┴──────────────────────────────────────────────────────────────┴──────┴──────┴──────┘
*/
[1] = LAYOUT_qwerty( \
[1] = LAYOUT_qwerty(
LALT(KC_F4), KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10 , KC_F11 , KC_F12 , _______,
_______ , _______ , _______ , KC_PSCR , KC_BRIU , KC_BRID, LCTL(KC_A), KC_HOME, KC_UP , KC_END , UC(0x203D) , UC(0x8593), UC(0x2E2E),
_______ , _______ , LSFT(KC_DEL), LCTL(KC_INS), LSFT(KC_INS), KC_DEL , KC_DEL , KC_LEFT, KC_DOWN, KC_RIGHT, UC(0x8592) , UC(0x8595), UC(0x8594), _______,
_______ , _______ , _______ , _______ , _______ , _______, LCTL(KC_A), KC_HOME, KC_UP , KC_END , _______ , _______ , _______ ,
_______ , _______ , LSFT(KC_DEL), LCTL(KC_INS), LSFT(KC_INS), KC_DEL , KC_DEL , KC_LEFT, KC_DOWN, KC_RIGHT, _______ , _______ , _______ , _______,
_______ , _______ , KC_MUTE , KC_VOLD , KC_VOLU , _______, _______ , _______, _______, _______ , _______ , RESET , _______ ,
_______ , _______ , _______ , _______, _______ , _______ , _______
)
};

// Set the unicode input mode for using UC.
void matrix_init_user(void) {
set_unicode_input_mode(UC_LNX);
}

void q_w(qk_tap_dance_state_t *state, void *user_data) {
if (state->count > 1) {
register_code(KC_W);
} else {
register_code(KC_Q);
}
}

void q_w_reset(qk_tap_dance_state_t *state, void *user_data) {
if (state->count > 1) {
unregister_code(KC_W);
} else {
unregister_code(KC_Q);
}
}

// All tap dance functions would go here. Only showing this one.
qk_tap_dance_action_t tap_dance_actions[] = {
[CT_QW] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, q_w, q_w_reset)
};

// Processing all the key pressed.
// Alt+tab.
bool process_record_user(uint16_t keycode, keyrecord_t *record) {

// Depending keycodes…
switch (keycode) { // This will do most of the grunt work with the keycodes.
case ALT_TAB:
if (record->event.pressed) {
if (!is_alt_tab_active) {
is_alt_tab_active = true;
register_code(KC_LALT);
}
alt_tab_timer = timer_read();
register_code(KC_TAB);
} else {
unregister_code(KC_TAB);
}
break;
}
return true;
}

void matrix_scan_user(void) { // The very important timer.
if (is_alt_tab_active) {
if (timer_elapsed(alt_tab_timer) > 750) {
unregister_code(KC_LALT);
is_alt_tab_active = false;
}
}
}
2 changes: 1 addition & 1 deletion keyboards/handwired/aek64/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
NKRO_ENABLE = no # USB Nkey Rollover - not yet supported in LUFA
UNICODE_ENABLE = yes # Enable support for arrow keys icon on the second layer.
COMBO_ENABLE = yes # Enable combo for special function when using multiple keys at once.
TAP_DANCE_ENABLE = yes # Enable use multiple tap
TAP_DANCE_ENABLE = no # Enable use multiple tap

0 comments on commit 5d6ff86

Please sign in to comment.