keymap.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* Copyright 2017 Wunder
  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 "xd75.h"
  17. #include "action_layer.h"
  18. enum custom_keycodes {
  19. // TD_ESC = 0,
  20. TD_LOCK = 0,
  21. };
  22. // Layers
  23. #define _QWERTY 0
  24. #define _LOWER 1
  25. #define _RAISE 2
  26. // Shortcuts
  27. #define KC_____ KC_NO
  28. #define KC_ KC_TRNS
  29. #define KC_RST RESET
  30. #define KC_RASE MO(_RAISE)
  31. #define KC_LOWR MO(_LOWER)
  32. // RGB and Backlighting
  33. #define KC_RGB RGB_TOG
  34. #define KC_RHUI RGB_HUI
  35. #define KC_RHUD RGB_HUD
  36. #define KC_RSAI RGB_SAI
  37. #define KC_RSAD RGB_SAD
  38. #define KC_RVAI RGB_VAI
  39. #define KC_RVAD RGB_VAD
  40. #define KC_BLT BL_TOGG
  41. #define KC_BLS BL_STEP
  42. #define KC_BLI BL_INC
  43. #define KC_BLD BL_DEC
  44. // Tapdance
  45. //#define KC_EXC TD(TD_ESC)
  46. #define KC_LOCK TD(TD_LOCK)
  47. // Macros
  48. #define KC_ROOT M(0)
  49. #define KC_PPLY M(1)
  50. #define KC_PSEF M(2)
  51. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  52. [_QWERTY] = KC_KEYMAP(
  53. // .--------------------------------------------------------------------------.
  54. ESC, 1 , 2 , 3 , 4 , 5 ,PGUP,PSCR,PGDN, 6 , 7 , 8 , 9 , 0 ,BSPC,
  55. // |----+----+----+----+----+----+----+----+----+----+----+----+----+----+----|
  56. TAB, Q , W , E , R , T , INS,BSLS, DEL, Y , U , I , O , P ,QUOT,
  57. // |----+----+----+----+----+----+----+----+----+----+----+----+----+----+----|
  58. LCTL, A , S , D , F , G ,HOME,PLUS,LOCK, H , J , K , L ,SCLN, ENT,
  59. // |----+----+----+----+----+----+----+----+----+----+----+----+----+----+----|
  60. LSFT, Z , X , C , V , B ,LBRC,MINS,RBRC, N , M ,COMM, DOT,SLSH,RSFT,
  61. // |----+----+----+----+----+----+----+----+----+----+----+----+----+----+----|
  62. LOWR,LCTL,LALT,LGUI,____, SPC,RASE, GRV,LOWR, SPC,____,LEFT,DOWN,UP ,RGHT
  63. // '----+----+----+----+----+----+----+----+----+----+----+----+----+----+----'
  64. ),
  65. [_LOWER] = KC_KEYMAP(
  66. // .--------------------------------------------------------------------------.
  67. ____, F1, F2, F3, F4, F5, F6,____, F7, F8, F9, F10, F11, F12,____,
  68. // |----+----+----+----+----+----+----+----+----+----+----+----+----+----+----|
  69. ____,ROOT,PPLY,PSEF,____,____,____,____,____,____,____,____,____,____,____,
  70. // |----+----+----+----+----+----+----+----+----+----+----+----+----+----+----|
  71. ____,____,____,____,____,____,____,____,____,____,____,____,____,____,____,
  72. // |----+----+----+----+----+----+----+----+----+----+----+----+----+----+----|
  73. ____,____,____,____,____,____,____,____,____,____,____,____,____,____,MUTE,
  74. // |----+----+----+----+----+----+----+----+----+----+----+----+----+----+----|
  75. ,____,____,____,____,____, ,____, ,MPLY,____,MPRV,VOLD,VOLU,MNXT
  76. // '----+----+----+----+----+----+----+----+----+----+----+----+----+----+----'
  77. ),
  78. [_RAISE] = KC_KEYMAP(
  79. // .--------------------------------------------------------------------------.
  80. ____,____,____,____,____,____,____,____,____,____,____,____,____,____,____,
  81. // |----+----+----+----+----+----+----+----+----+----+----+----+----+----+----|
  82. ____,____,____,____, RST,____,____,____,____,____,____,____,____,____,____,
  83. // |----+----+----+----+----+----+----+----+----+----+----+----+----+----+----|
  84. CAPS,____,____,____,____,____,____, BLI,____,____,____,____,____,____,____,
  85. // |----+----+----+----+----+----+----+----+----+----+----+----+----+----+----|
  86. RGB,RHUI,RHUD,RSAI,RSAD,RVAI,RVAD, BLD,____,____,____,____,BTN1,BTN2,____,
  87. // |----+----+----+----+----+----+----+----+----+----+----+----+----+----+----|
  88. ,____,____,____,____,____, ,____, ,____,____,MS_L,MS_D,MS_U,MS_R
  89. // '----+----+----+----+----+----+----+----+----+----+----+----+----+----+----'
  90. )
  91. };
  92. qk_tap_dance_action_t tap_dance_actions[] = {
  93. //Tap once for left ctrl, twice for ESC
  94. //[TD_ESC] = ACTION_TAP_DANCE_DOUBLE(KC_LCTL, KC_ESC),
  95. [TD_LOCK] = ACTION_TAP_DANCE_DOUBLE(KC_END, LGUI(KC_L))
  96. };
  97. void led_set_user(uint8_t usb_led) {
  98. if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
  99. capslock_led_on();
  100. } else {
  101. capslock_led_off();
  102. }
  103. }
  104. const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
  105. if (record->event.pressed) {
  106. switch(id) {
  107. case 0:
  108. SEND_STRING("sudo su -\n");
  109. return false; break;
  110. case 1:
  111. SEND_STRING("puppet apply /etc/puppetlabs/code/environments/production/manifests/site.pp\n");
  112. return false; break;
  113. case 2:
  114. SEND_STRING("ps -ef | grep ");
  115. return false; break;
  116. }
  117. }
  118. return MACRO_NONE;
  119. };