2
0

keymap.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #include "gherkin.h"
  2. #include "action_layer.h"
  3. extern rgblight_config_t rgblight_config;
  4. extern keymap_config_t keymap_config;
  5. #define _PS 0 // This is the Photoshop Layer
  6. #define _AI 1 // This is the Illustrator Layer
  7. #define _PR 2 // This is the Premier Layer
  8. enum custom_keycodes {
  9. PS = SAFE_RANGE,
  10. AI,
  11. PR,
  12. };
  13. #define PS TO(0)
  14. #define AI TO(1)
  15. #define PR TO(2)
  16. // Mix of Photoshop, Illustrator, and Premiere shortcuts.
  17. #define SAVE LCTL(KC_S)
  18. #define OPEN LCTL(KC_O)
  19. #define COPY LCTL(KC_C)
  20. #define PAST LCTL(KC_V)
  21. #define CUNDO LCTL(LALT(KC_Z))
  22. #define INVERT LCTL(LSFT(KC_I))
  23. #define NLAYER LSFT(LCTL(KC_N))
  24. #define UNDO LCTL(KC_Z)
  25. #define TRANS LCTL(KC_T)
  26. #define ALIGNL LCTL(LSFT(KC_L))
  27. #define ALIGNC LCTL(LSFT(KC_C))
  28. #define ALIGNR LCTL(LSFT(KC_R))
  29. #define BRINGF LCTL(KC_RBRC)
  30. #define BRINGB LCTL(KC_LBRC)
  31. // Some illustrator only shortcuts.
  32. #define SHAPE LSFT(KC_M)
  33. #define RULER LCTL(LALT(KC_R))
  34. // Premiere only shortcuts.
  35. #define REDO LCTL(LSFT(KC_Z))
  36. #define EXPORT LCTL(KC_M)
  37. #define IMPORT LCTL(KC_I)
  38. #define PCOPY LCTL(KC_V)
  39. #define PPASTE LCTL(LSFT(KC_V))
  40. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  41. // Photoshop layer.
  42. [_PS] = KEYMAP(
  43. SAVE, KC_W, KC_E, KC_T, KC_U, KC_I, KC_P, INVERT, CUNDO, NLAYER,
  44. UNDO, KC_H, KC_L, TRANS, ALIGNL, ALIGNC, ALIGNR, BRINGB, BRINGF, OPEN,
  45. KC_LSFT, COPY, PAST, KC_Z, KC_C, KC_V, KC_B, KC_LBRC, KC_RBRC, AI),
  46. [_AI] = KEYMAP(
  47. KC_TRNS, M(0), RULER, KC_TRNS, KC_G, KC_TRNS, KC_TRNS, KC_Q, KC_MINS, KC_PLUS,
  48. KC_TRNS, KC_TRNS, KC_TRNS, KC_E, KC_TRNS, KC_TRNS, KC_TRNS, SHAPE, KC_O, OPEN,
  49. KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_M, KC_SLSH, PR),
  50. [_PR] = KEYMAP(
  51. KC_TRNS, KC_Q, KC_W, KC_I, KC_O, KC_P, IMPORT, EXPORT, KC_MINS, KC_EQL,
  52. KC_TRNS, REDO, KC_D, KC_F, KC_H, KC_M, KC_ENT, KC_LBRC, KC_RBRC, OPEN,
  53. KC_TRNS, PCOPY, PPASTE, KC_SPC, KC_Z, KC_C, KC_V, KC_LEFT, KC_RIGHT, PS),
  54. };
  55. void persistent_default_layer_set(uint16_t default_layer) {
  56. eeconfig_update_default_layer(default_layer);
  57. default_layer_set(default_layer);
  58. }
  59. void matrix_init_user(void) {
  60. rgblight_enable();
  61. }
  62. void matrix_scan_user(void) {
  63. #ifdef RGBLIGHT_ENABLE
  64. static uint8_t old_layer = 255;
  65. uint8_t new_layer = biton32(layer_state);
  66. // Color of the Icons.
  67. if (old_layer != new_layer) {
  68. switch (new_layer) {
  69. case _PS:
  70. rgblight_setrgb(49, 197, 240);
  71. break;
  72. case _AI:
  73. rgblight_setrgb(255, 128, 17);
  74. break;
  75. case _PR:
  76. rgblight_setrgb(231, 136, 255);
  77. break;
  78. }
  79. old_layer = new_layer;
  80. }
  81. #endif
  82. }
  83. const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
  84. keyevent_t event = record->event;
  85. (void)event;
  86. switch (id) {
  87. case 0:
  88. // Save for Web Macro.
  89. return MACRO(D(LSFT), D(LALT), D(LCTL), T(S), U(LCTL), U(LALT), U(LSFT), END);
  90. }
  91. return MACRO_NONE;
  92. }
  93. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  94. switch (keycode) {
  95. }
  96. return true;
  97. }