You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
5.8 KiB

  1. /* Copyright 2020 Guillaume Gérard
  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. #include "programmer.h"
  17. bool process_record_pg(uint16_t keycode, keyrecord_t *record) {
  18. switch (keycode) {
  19. case QWERTY_PROGRAMMER:
  20. if (record->event.pressed) {
  21. set_single_persistent_default_layer(_QWERTY_PROGRAMMER);
  22. }
  23. return false;
  24. case WORKMAN_PROGRAMMER:
  25. if (record->event.pressed) {
  26. set_single_persistent_default_layer(_WORKMAN_PROGRAMMER);
  27. }
  28. return false;
  29. case COLEMAK_PROGRAMMER:
  30. if (record->event.pressed) {
  31. set_single_persistent_default_layer(_COLEMAK_PROGRAMMER);
  32. }
  33. return false;
  34. case DVORAK_PROGRAMMER:
  35. if (record->event.pressed) {
  36. set_single_persistent_default_layer(_DVORAK_PROGRAMMER);
  37. }
  38. return false;
  39. case PG_GRV:
  40. if (record->event.pressed) {
  41. uint8_t current_mods = get_mods();
  42. if (current_mods & MOD_MASK_SHIFT) {
  43. clear_mods();
  44. SEND_STRING("`");
  45. set_mods(current_mods);
  46. } else {
  47. SEND_STRING("~");
  48. }
  49. }
  50. return false;
  51. case PG_1:
  52. if (record->event.pressed) {
  53. uint8_t current_mods = get_mods();
  54. if (current_mods & MOD_MASK_SHIFT) {
  55. clear_mods();
  56. SEND_STRING("1");
  57. set_mods(current_mods);
  58. } else {
  59. SEND_STRING("!");
  60. }
  61. }
  62. return false;
  63. case PG_2:
  64. if (record->event.pressed) {
  65. uint8_t current_mods = get_mods();
  66. if (current_mods & MOD_MASK_SHIFT) {
  67. clear_mods();
  68. SEND_STRING("2");
  69. set_mods(current_mods);
  70. } else {
  71. SEND_STRING("@");
  72. }
  73. }
  74. return false;
  75. case PG_3:
  76. if (record->event.pressed) {
  77. uint8_t current_mods = get_mods();
  78. if (current_mods & MOD_MASK_SHIFT) {
  79. clear_mods();
  80. SEND_STRING("3");
  81. set_mods(current_mods);
  82. } else {
  83. SEND_STRING("#");
  84. }
  85. }
  86. return false;
  87. case PG_4:
  88. if (record->event.pressed) {
  89. uint8_t current_mods = get_mods();
  90. if (current_mods & MOD_MASK_SHIFT) {
  91. clear_mods();
  92. SEND_STRING("4");
  93. set_mods(current_mods);
  94. } else {
  95. SEND_STRING("$");
  96. }
  97. }
  98. return false;
  99. case PG_5:
  100. if (record->event.pressed) {
  101. uint8_t current_mods = get_mods();
  102. if (current_mods & MOD_MASK_SHIFT) {
  103. clear_mods();
  104. SEND_STRING("5");
  105. set_mods(current_mods);
  106. } else {
  107. SEND_STRING("%");
  108. }
  109. }
  110. return false;
  111. case PG_6:
  112. if (record->event.pressed) {
  113. uint8_t current_mods = get_mods();
  114. if (current_mods & MOD_MASK_SHIFT) {
  115. clear_mods();
  116. SEND_STRING("6");
  117. set_mods(current_mods);
  118. } else {
  119. SEND_STRING("^");
  120. }
  121. }
  122. return false;
  123. case PG_7:
  124. if (record->event.pressed) {
  125. uint8_t current_mods = get_mods();
  126. if (current_mods & MOD_MASK_SHIFT) {
  127. clear_mods();
  128. SEND_STRING("7");
  129. set_mods(current_mods);
  130. } else {
  131. SEND_STRING("&");
  132. }
  133. }
  134. return false;
  135. case PG_8:
  136. if (record->event.pressed) {
  137. uint8_t current_mods = get_mods();
  138. if (current_mods & MOD_MASK_SHIFT) {
  139. clear_mods();
  140. SEND_STRING("8");
  141. set_mods(current_mods);
  142. } else {
  143. SEND_STRING("*");
  144. }
  145. }
  146. return false;
  147. case PG_9:
  148. if (record->event.pressed) {
  149. uint8_t current_mods = get_mods();
  150. if (current_mods & MOD_MASK_SHIFT) {
  151. clear_mods();
  152. SEND_STRING("9");
  153. set_mods(current_mods);
  154. } else {
  155. SEND_STRING("(");
  156. }
  157. }
  158. return false;
  159. case PG_0:
  160. if (record->event.pressed) {
  161. uint8_t current_mods = get_mods();
  162. if (current_mods & MOD_MASK_SHIFT) {
  163. clear_mods();
  164. SEND_STRING("0");
  165. set_mods(current_mods);
  166. } else {
  167. SEND_STRING(")");
  168. }
  169. }
  170. return false;
  171. }
  172. return true;
  173. }