secrets.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* Copyright 2021 Joshua T.
  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. // Before you can compile with this feature, you'll need to manually
  17. // create a file in this directory called "secret_definitions.h"
  18. // containing the data to be added.
  19. //
  20. // Example implementation:
  21. //
  22. // #pragma once
  23. // static const char * const secrets[] = {
  24. // "secret1",
  25. // "secret2",
  26. // "secret3",
  27. // "secret4"
  28. // }
  29. #include QMK_KEYBOARD_H
  30. #include "replicaJunction.h"
  31. #include "secrets.h"
  32. #include "secret_definitions.h"
  33. #ifndef MACRO_TIMER
  34. # define MACRO_TIMER 5
  35. #endif
  36. bool process_record_secrets(uint16_t keycode, const keyrecord_t *record) {
  37. switch (keycode) {
  38. case K_SECR1 ... K_SECR4: // Secrets! Externally defined strings, not stored in repo
  39. if (!record->event.pressed) {
  40. clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
  41. send_string_with_delay(secrets[keycode - K_SECR1], MACRO_TIMER);
  42. }
  43. return false;
  44. }
  45. return true;
  46. }