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.

80 lines
2.3 KiB

  1. /* Copyright 2021 moults31
  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 "obs.h"
  17. bool process_record_obs(uint16_t keycode, keyrecord_t *record) {
  18. // Apply all 4 mods for custom OBS macros
  19. register_code(KC_LSHIFT);
  20. register_code(KC_LCTL);
  21. register_code(KC_LALT);
  22. register_code(KC_LGUI);
  23. switch (keycode) {
  24. case M_OBS_BRB:
  25. if (record->event.pressed) {
  26. SEND_STRING("1");
  27. }
  28. break;
  29. case M_OBS_GAME:
  30. if (record->event.pressed) {
  31. SEND_STRING("2");
  32. }
  33. break;
  34. case M_OBS_JSTCHT:
  35. if (record->event.pressed) {
  36. SEND_STRING("3");
  37. }
  38. break;
  39. case M_OBS_DSKT_MUTE:
  40. if (record->event.pressed) {
  41. SEND_STRING("4");
  42. }
  43. break;
  44. case M_OBS_DSKT_UNMUTE:
  45. if (record->event.pressed) {
  46. SEND_STRING("5");
  47. }
  48. break;
  49. case M_OBS_VOICE_MUTE:
  50. if (record->event.pressed) {
  51. SEND_STRING("6");
  52. }
  53. break;
  54. case M_OBS_VOICE_UNMUTE:
  55. if (record->event.pressed) {
  56. SEND_STRING("7");
  57. }
  58. break;
  59. case M_OBS_MOOSIC_MUTE:
  60. if (record->event.pressed) {
  61. SEND_STRING("8");
  62. }
  63. break;
  64. case M_OBS_MOOSIC_UNMUTE:
  65. if (record->event.pressed) {
  66. SEND_STRING("9");
  67. }
  68. break;
  69. }
  70. // Unpress all 4 mods for custom OBS macros
  71. unregister_code(KC_LSHIFT);
  72. unregister_code(KC_LCTL);
  73. unregister_code(KC_LALT);
  74. unregister_code(KC_LGUI);
  75. return true;
  76. }