Skip to content

Commit

Permalink
[Keymap] Ergodash keymap for yet-another-developer (qmk#7046)
Browse files Browse the repository at this point in the history
* Initialize ergodash rev 1 keymap

./util/new_keymap.sh ergodash/rev1 yet-another-developer

* Add user space configurations referenced from drashna

* Start community layout for ergodash in ortho_5x14

* Remove unused layers

* Add userspace layers

* Add Userspace gitignore

Hide Secrets

* Remove userspace unused drashna features

* Scrap default keymap and follow drashna's template

* Add code referenced from kuchosauronad0

* Make sure that the author is named Developer

* Replace middle keys del and bksp with curly brace

* Reduce ONESHOT_TIMEOUT from 3sec to 2sec

* Remove adjust key AG_SWAP

* Disable UNICODEMAP_ENABLE, remove code causing build fail

* Increase TAPPING_TERM to 240

Reason:  Because Space is also LOWER, space sometimes not registering.
PS: I dont want to #define RETRO_TAPPING yet

* Update KC_MAKE to use :flash

* Remove TAP_ONCE, use tap_code

Signed-off-by: Developer <anotherdeveloper@icloud.com>

* Remove redundant code implementation of keyboard_post_init_user

qmk#7046

users/yet-another-developer/leader.c
```
  static bool has_ran_yet;
  if (!has_ran_yet) {
    has_ran_yet = true;
    startup_user();
```
Comment for lines +11  – +14
 @drashna: Not needed anymore. You can use keyboard_post_init_user now.

Signed-off-by: Developer <anotherdeveloper@icloud.com>
  • Loading branch information
yet-another-developer authored and drashna committed Oct 20, 2019
1 parent b886d68 commit f72d73b
Show file tree
Hide file tree
Showing 20 changed files with 1,371 additions and 0 deletions.
22 changes: 22 additions & 0 deletions layouts/community/ortho_5x14/yet-another-developer/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once

/* ws2812 RGB LED */
#if defined(KEYBOARD_fractal)
# define RGB_DI_PIN D2
# undef RGBLED_NUM
# define RGBLIGHT_ANIMATIONS
# define RGBLED_NUM 29 // Number of LEDs
# undef RGBLIGHT_HUE_STEP
# define RGBLIGHT_HUE_STEP 8
# undef RGBLIGHT_SAT_STEP
# define RGBLIGHT_SAT_STEP 8
# undef RGBLIGHT_VAL_STEP
# define RGBLIGHT_VAL_STEP 8
# define RGBLIGHT_LIMIT_VAL 175
# define RGBLIGHT_SLEEP

# define RGBLIGHT_EFFECT_KNIGHT_OFFSET 3
# define RGBLIGHT_EFFECT_KNIGHT_LED_NUM 14
# define B7_AUDIO
# define NO_MUSIC_MODE
#endif
208 changes: 208 additions & 0 deletions layouts/community/ortho_5x14/yet-another-developer/keymap.c

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions users/yet-another-developer/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
secrets.c
secrets.h
7 changes: 7 additions & 0 deletions users/yet-another-developer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# User Space for yet-another-developer


## Reference / Inspiration
- /u/kuchosauronad0
- /u/drashna
- /u/not-quite-neo
27 changes: 27 additions & 0 deletions users/yet-another-developer/combo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "combo.h"

void process_combo_event(uint8_t combo_index, bool pressed){
switch(combo_index) {
case ZV_COPY:
if (pressed) {
tap_code16(LCTL(KC_C));
}
break;
case XV_CUT:
if (pressed) {
tap_code16(LCTL(KC_X));
}
break;

case CV_PASTE:
if (pressed) {
tap_code16(LCTL(KC_V));
}
break;
case QP_SLEEP:
if (pressed) {
tap_code16(KC_SYSTEM_SLEEP);
}
break;
}
}
21 changes: 21 additions & 0 deletions users/yet-another-developer/combo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once
#include "quantum.h"
enum combo_events {
ZV_COPY,
XV_CUT,
CV_PASTE,
QP_SLEEP
};

const uint16_t PROGMEM copy_combo[] = {KC_Z, KC_V, COMBO_END};
const uint16_t PROGMEM cut_combo[] = {KC_X, KC_V, COMBO_END};
const uint16_t PROGMEM paste_combo[] = {KC_C, KC_V, COMBO_END};
const uint16_t PROGMEM sleep_combo[] = {KC_Q, KC_P, COMBO_END};

combo_t key_combos[COMBO_COUNT] = {
[ZV_COPY] = COMBO_ACTION(copy_combo),
[XV_CUT] = COMBO_ACTION(cut_combo),
[CV_PASTE] = COMBO_ACTION(paste_combo),
[QP_SLEEP] = COMBO_ACTION(sleep_combo),
};

56 changes: 56 additions & 0 deletions users/yet-another-developer/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#pragma once

/* Set Polling rate to 1000Hz */
#define USB_POLLING_INTERVAL_MS 1

#ifndef ONESHOT_TAP_TOGGLE
#define ONESHOT_TAP_TOGGLE 2
#endif // !ONESHOT_TAP_TOGGLE

#ifndef ONESHOT_TIMEOUT
#define ONESHOT_TIMEOUT 2000
#endif // !ONESHOT_TIMEOUT

#ifndef QMK_KEYS_PER_SCAN
#define QMK_KEYS_PER_SCAN 4
#endif // !QMK_KEYS_PER_SCAN

#if defined(LEADER_ENABLE)
#define LEADER_PER_KEY_TIMING
#define LEADER_TIMEOUT 250
#endif // !LEADER_ENABLE

#if defined(COMBO_ENABLE)
#define COMBO_COUNT 4
#define COMBO_TERM 150
#endif // !COMBO_ENABLE

#if defined(NKRO_ENABLE)
#define FORCE_NKRO
#endif // !NKRO_ENABLE

// this makes it possible to do rolling combos (zx) with keys that
// convert to other keys on hold (z becomes ctrl when you hold it,
// and when this option isn't enabled, z rapidly followed by x
// actually sends Ctrl-x. That's bad.)
#define IGNORE_MOD_TAP_INTERRUPT
#undef PERMISSIVE_HOLD
//#define TAPPING_FORCE_HOLD
//#define RETRO_TAPPING

#ifndef TAPPING_TOGGLE
#define TAPPING_TOGGLE 1
#endif

#ifdef TAPPING_TERM
# undef TAPPING_TERM
#endif // !TAPPING_TERM
#if defined(KEYBOARD_ergodash)
#define TAPPING_TERM 240
#else
#define TAPPING_TERM 200
#endif

#define TAP_CODE_DELAY 5 //DEFAULT: 100

#define MACRO_TIMER 5
46 changes: 46 additions & 0 deletions users/yet-another-developer/leader.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include "leader.h"

LEADER_EXTERNS();

// Runs constantly in the background, in a loop.
void matrix_scan_user(void){

#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
// run_diablo_macro_check();
#endif // TAP_DANCE_ENABLE

#ifdef RGBLIGHT_ENABLE
matrix_scan_rgb();
#endif // RGBLIGHT_ENABLE

LEADER_DICTIONARY() {
leading = false;
leader_end();

SEQ_TWO_KEYS(KC_V, KC_Z){
// vim: Zoom pane
tap_code16(LCTL(KC_W));
tap_code16(LSFT(KC_BSLS));
}

SEQ_TWO_KEYS(KC_V, KC_R) {
// vim: Substitute and place cursor
SEND_STRING(":%s///g" SS_TAP(X_LEFT));
tap_code(KC_LEFT);
tap_code(KC_LEFT);
}

SEQ_TWO_KEYS(KC_V, KC_T) {
// vim: move current pane to new tab
tap_code16(LCTL(KC_W));
tap_code16(LSFT(KC_T));
}

SEQ_THREE_KEYS(KC_BSPC, KC_BSPC, KC_BSPC){
// Reset the keyboard
reset_keyboard();
}
}

matrix_scan_keymap();
}
6 changes: 6 additions & 0 deletions users/yet-another-developer/leader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once
#include "yet-another-developer.h"

#include "leader.h"

void matrix_scan_user(void);
193 changes: 193 additions & 0 deletions users/yet-another-developer/process_records.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
#include "yet-another-developer.h"

uint16_t copy_paste_timer;

__attribute__ ((weak))
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}

__attribute__ ((weak))
bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
return true;
}

// Defines actions for my global custom keycodes. Defined in yet-another-developer.h file
// Then runs the _keymap's record handier if not processed here
bool process_record_user(uint16_t keycode, keyrecord_t *record) {

// If console is enabled, it will print the matrix position and status of each key pressed
#ifdef KEYLOGGER_ENABLE
#if defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_keebio_iris_rev2)
xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.row, record->event.key.col, record->event.pressed);
#else
xprintf("KL: kc: %u, col: %u, row: %u, pressed: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed);
#endif
#endif //KEYLOGGER_ENABLE

switch (keycode) {
case KC_QWERTY ... KC_UNICODE:
if (record->event.pressed) {
set_single_persistent_default_layer(keycode - KC_QWERTY);
}
break;

case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
if (!record->event.pressed) {
clear_mods();
clear_oneshot_mods();
send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP), TAP_CODE_DELAY);
{
send_string_with_delay_P(PSTR(":flash"), TAP_CODE_DELAY);
}
}
break;

/* Tap Dance */
case MC_QT1: // ""
if(record->event.pressed){
SEND_STRING("\"\"");
tap_code(KC_LEFT);
}
break;
case MC_QT2: // ''
if(record->event.pressed){
SEND_STRING("''");
tap_code(KC_LEFT);
}
break;
case MC_QT3: // `'
if(record->event.pressed){
SEND_STRING("`'");
tap_code(KC_LEFT);
}
break;
case MC_PAR: // Parenthesis
if(record->event.pressed){
SEND_STRING("()");
tap_code(KC_LEFT);
}
break;
case MC_CUR: // Curly bracket
if(record->event.pressed){
SEND_STRING("{}");
tap_code(KC_LEFT);
}
break;
case MC_SQR: // Square bracket
if(record->event.pressed){
SEND_STRING("[]");
tap_code(KC_LEFT);
}
break;
case MC_ABR: // Angle bracket
if(record->event.pressed){
SEND_STRING("<>");
tap_code(KC_LEFT);
}
break;
case MCT_NEW: // New Tmux Session
if(record->event.pressed){
SEND_STRING(":neww");
tap_code(KC_ENT);
}
break;
case MCT_SH: // Tmux horizontal split
if(record->event.pressed){
SEND_STRING("%");
}
break;
case MCT_SV: // Tmux vertical split
if(record->event.pressed){
SEND_STRING("\"");
}
break;
case MCT_ZM: // Tmux zoom
if(record->event.pressed){
tap_code(KC_Z);
}
break;
case MCT_SCR: // Tmux scroll mode
if(record->event.pressed){
tap_code(KC_PGUP);
}
break;
case MCT_UP: // Tmux up
break;
case MCT_DW: // Tmux down
break;
case MCT_LFT: // Tmux left
break;
case MCT_RGT: // Tmux right
tap_code(KC_RIGHT);
break;
case MCV_B: // Vim begin of line
if(record->event.pressed){
tap_code(KC_0);
}
break;
case MCV_E: // Vim end of line
if(record->event.pressed){
SEND_STRING(":vsplit");
tap_code(KC_ENT);
}
break;
case MCT_F: // Vim for loop
if(record->event.pressed){
SEND_STRING(":help");
tap_code(KC_ENT);
}
break;

case VRSN: // Prints firmware version
if (record->event.pressed) {
send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY);
}
break;


case KC_CCCV: // One key copy/paste
if (record->event.pressed) {
copy_paste_timer = timer_read();
} else {
if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy
register_code(KC_LCTL);
tap_code(KC_C);
unregister_code(KC_LCTL);
} else { // Tap, paste
register_code(KC_LCTL);
tap_code(KC_V);
unregister_code(KC_LCTL);
}
}
break;
#ifdef UNICODE_ENABLE
case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻
if (record->event.pressed) {
send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B");
}
break;
case UC_TABL: // ┬─┬ノ( º _ ºノ)
if (record->event.pressed) {
send_unicode_hex_string("252C 2500 252C 30CE 0028 0020 00BA 0020 005F 0020 00BA 30CE 0029");
}
break;
case UC_SHRG: // ¯\_(ツ)_/¯
if (record->event.pressed) {
send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF");
}
break;
case UC_DISA: // ಠ_ಠ
if (record->event.pressed) {
send_unicode_hex_string("0CA0 005F 0CA0");
}
break;
#endif // UNICODE_ENABLE
}

return process_record_keymap(keycode, record) &&
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
process_record_user_rgb(keycode, record) &&
#endif // RGBLIGHT_ENABLE
process_record_secrets(keycode, record);
}
Loading

0 comments on commit f72d73b

Please sign in to comment.