keymap.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright 2022 Ulrich Spörlein (@uqs)
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. // vi:et sw=4:
  4. #include QMK_KEYBOARD_H
  5. enum custom_keycodes {
  6. DBL_CLK_NO = SAFE_RANGE,
  7. };
  8. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  9. switch (keycode) {
  10. // This works fine in xev(1) or a browser, but not in the game where I
  11. // would want it. Maybe need to increase the delay? Also needs to be
  12. // rewritten to use Deferred Execution.
  13. case DBL_CLK_NO:
  14. if (record->event.pressed) {
  15. tap_code(KC_BTN2);
  16. wait_ms(150);
  17. tap_code(KC_BTN2);
  18. wait_ms(300);
  19. tap_code(KC_N);
  20. }
  21. return false;
  22. }
  23. return true;
  24. }
  25. // Layout is:
  26. // left-most, M1, M3, M2, right-most, fwd, back (on side), tiny middle one
  27. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  28. [0] = LAYOUT(KC_E, KC_BTN1, KC_BTN3, KC_BTN2, KC_LSFT, KC_BTN4, KC_BTN5, DF(1)), // shooters
  29. [1] = LAYOUT(KC_1, KC_BTN1, KC_Y, KC_BTN2, DBL_CLK_NO, KC_N, KC_Y, DF(0)), // stardew valley, sword on 1
  30. };