Skip to content

Commit

Permalink
[master] Add copy and paste buttons to Ergodox
Browse files Browse the repository at this point in the history
  • Loading branch information
zored committed Sep 25, 2021
1 parent 208d5d4 commit 60dd93c
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 11 deletions.
21 changes: 21 additions & 0 deletions compiler/template/zored_keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ enum do_command {
DO_ENPASS,
DO_MAIL,
DO_LOGIN,
DO_COPY, DO_PASTE,
DO_TERMINAL,
DO_SCREENSHOT,
DO_BOOTLOADER,
Expand Down Expand Up @@ -518,6 +519,26 @@ void run_advanced (uint8_t command) {
break;
}
break;
case DO_COPY:
switch (zored_os) {
case OS_MACOS:
tap_code16(G(KC_C));
break;
case OS_WINDOWS:
tap_code16(C(KC_C));
break;
}
break;
case DO_PASTE:
switch (zored_os) {
case OS_MACOS:
tap_code16(G(KC_V));
break;
case OS_WINDOWS:
tap_code16(C(KC_V));
break;
}
break;
case DO_BOOTLOADER:
clear_keyboard();
bootloader_jump();
Expand Down
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ keyboards:
- [esc, q, w, e, r, t, ~]
- [capsDance, aDance, s, d, f, g]
- ['shift(', zDance, xDance, cDance, v, b, doFutureApp]
- [leader, toggleNavigation, ~, doFutureTab, doPastTab]
- [leader, toggleNavigation, ~, doCopy, doPaste]
left-thumb:
- [esc, doOneShotTurbo]
- [home]
Expand Down
47 changes: 39 additions & 8 deletions example/ergodox_ez/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ enum custom_keycodes {
ZKC_BTL = SAFE_RANGE,
KC_DO_NEXT_LANGUAGE,
KC_DO_FUTURE_APP,
KC_DO_FUTURE_TAB,
KC_DO_PAST_TAB,
KC_DO_COPY,
KC_DO_PASTE,
KC_DO_ONE_SHOT_TURBO,
KC_DO_PAST_APP,
KC_DO_PAST_WINDOW,
KC_DO_FUTURE_WINDOW,
KC_DO_PAST,
KC_DO_FUTURE,
KC_DO_BOOTLOADER,
KC_DO_FUTURE_TAB,
KC_DO_PAST_TAB,


// At the end:
Expand Down Expand Up @@ -125,6 +127,7 @@ enum do_command {
DO_ENPASS,
DO_MAIL,
DO_LOGIN,
DO_COPY, DO_PASTE,
DO_TERMINAL,
DO_SCREENSHOT,
DO_BOOTLOADER,
Expand Down Expand Up @@ -507,6 +510,26 @@ void run_advanced (uint8_t command) {
break;
}
break;
case DO_COPY:
switch (zored_os) {
case OS_MACOS:
tap_code16(G(KC_C));
break;
case OS_WINDOWS:
tap_code16(C(KC_C));
break;
}
break;
case DO_PASTE:
switch (zored_os) {
case OS_MACOS:
tap_code16(G(KC_V));
break;
case OS_WINDOWS:
tap_code16(C(KC_V));
break;
}
break;
case DO_BOOTLOADER:
clear_keyboard();
bootloader_jump();
Expand Down Expand Up @@ -650,7 +673,7 @@ combo_t key_combos[COMBO_COUNT] = {
};


void process_combo_event(uint16_t combo_index, bool pressed) {
void process_combo_event(uint8_t combo_index, bool pressed) {
if (!pressed) {
return;
}
Expand Down Expand Up @@ -2502,7 +2525,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* left-1 */ KC_ESC,KC_Q,KC_W,KC_E,KC_R,KC_T,_______,
/* left-2 */ TD(DANCE_KC_CAPSDANCE),TD(DANCE_KC_ADANCE),KC_S,KC_D,KC_F,KC_G,
/* left-3 */ KC_LSPO,TD(DANCE_KC_ZDANCE),TD(DANCE_KC_XDANCE),TD(DANCE_KC_CDANCE),KC_V,KC_B,KC_DO_FUTURE_APP,
/* left-4 */ KC_LEAD,TG(LAYER_NAVIGATION),_______,KC_DO_FUTURE_TAB,KC_DO_PAST_TAB,
/* left-4 */ KC_LEAD,TG(LAYER_NAVIGATION),_______,KC_DO_COPY,KC_DO_PASTE,
/* left-thumb-0 */ KC_ESC,KC_DO_ONE_SHOT_TURBO,
/* left-thumb-1 */ KC_HOME,
/* left-thumb-2 */ KC_SPC,KC_BSPC,KC_END,
Expand Down Expand Up @@ -2788,12 +2811,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
run_advanced(DO_FUTURE_APP);
break;

case KC_DO_FUTURE_TAB:
run_advanced(DO_FUTURE_TAB);
case KC_DO_COPY:
run_advanced(DO_COPY);
break;

case KC_DO_PAST_TAB:
run_advanced(DO_PAST_TAB);
case KC_DO_PASTE:
run_advanced(DO_PASTE);
break;

case KC_DO_ONE_SHOT_TURBO:
Expand Down Expand Up @@ -2824,6 +2847,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
run_advanced(DO_BOOTLOADER);
break;

case KC_DO_FUTURE_TAB:
run_advanced(DO_FUTURE_TAB);
break;

case KC_DO_PAST_TAB:
run_advanced(DO_PAST_TAB);
break;


default:
return true;
Expand Down
9 changes: 7 additions & 2 deletions project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ run () {

if [[ "$OSTYPE" == "darwin"* ]]; then
export OS=MACOSX
wally="/usr/local/bin/wally-cli"
if which wally-cli; then
wally="wally-cli"
else
wally="/usr/local/bin/wally-cli"
fi
elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then
export OS=WINDOWS
wally="'/c/Program Files (x86)/Wally/wally-cli.exe'"
Expand Down Expand Up @@ -120,7 +124,8 @@ case $1 in
if [[ "$OS" = 'MACOSX' ]]; then
brew install libusb dfu-programmer
fi
go build -o wally-cli cli/main.go
go install github.com/wailsapp/wails/cmd/wails@v1.16.6
wails build
;;

provision-host)
Expand Down

0 comments on commit 60dd93c

Please sign in to comment.