qmk

QMK Firmware
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

keymap.c (3860B)


      1 #include QMK_KEYBOARD_H
      2 
      3 extern rgblight_config_t rgblight_config;
      4 extern keymap_config_t keymap_config;
      5 
      6 #define _PS 0 // This is the Photoshop Layer
      7 #define _AI 1 // This is the Illustrator Layer
      8 #define _PR 2 // This is the Premier Layer
      9 #define _XD 3 // This is the Experience Design Layer
     10 
     11 enum custom_keycodes {
     12   PS = SAFE_RANGE,
     13   AI,
     14   PR,
     15   MACRO_0,
     16 };
     17 
     18 #define PS TO(0)
     19 #define AI TO(1)
     20 #define PR TO(2)
     21 #define XD TO(3)
     22 
     23 // Mix of Photoshop, Illustrator, Premiere, and Experience Design shortcuts.
     24 #define SAVE  LCTL(KC_S)
     25 #define OPEN  LCTL(KC_O)
     26 #define COPY  LCTL(KC_C)
     27 #define PAST  LCTL(KC_V)
     28 #define CUNDO LCTL(LALT(KC_Z))
     29 #define INVERT LCTL(LSFT(KC_I))
     30 #define NLAYER LSFT(LCTL(KC_N))
     31 #define UNDO LCTL(KC_Z)
     32 #define TRANS LCTL(KC_T)
     33 #define ALIGNL LCTL(LSFT(KC_L))
     34 #define ALIGNC LCTL(LSFT(KC_C))
     35 #define ALIGNR LCTL(LSFT(KC_R))
     36 #define BRINGF LCTL(KC_RBRC)
     37 #define BRINGB LCTL(KC_LBRC)
     38 
     39 // Illustrator layer shortcuts.
     40 #define SHAPE LSFT(KC_M)
     41 #define RULER LCTL(LALT(KC_R))
     42 
     43 // Premiere layer shortcuts.
     44 #define REDO LCTL(LSFT(KC_Z))
     45 #define EXPORT LCTL(KC_M)
     46 #define IMPORT LCTL(KC_I)
     47 #define PCOPY LCTL(KC_V)
     48 #define PPASTE LCTL(LSFT(KC_V))
     49 
     50 // Experience Design layer shortcuts. (can be used with others too.)
     51 #define NEW LCTL(KC_N)
     52 #define LOCK LCTL(KC_L)
     53 #define SYMB LCTL(KC_K)
     54 #define HIDE LCTL(KC_SCLN)
     55 #define REPEAT LCTL(KC_R)
     56 #define MASK LCTL(LSFT(KC_M))
     57 #define GROUP LCTL(KC_G)
     58 #define UNGRP LCTL(LSFT(KC_G))
     59 #define VIEW LCTL(KC_TAB)
     60 #define HORZ LSFT(KC_C)
     61 #define VERT LSFT(KC_M)
     62 
     63 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
     64 
     65   // Photoshop layer
     66   [_PS] = LAYOUT_ortho_3x10(
     67     SAVE,    KC_W, KC_E, KC_T,  KC_U,   KC_I,   KC_P,   INVERT,  CUNDO,   NLAYER,
     68     UNDO,    KC_H, KC_L, TRANS, ALIGNL, ALIGNC, ALIGNR, BRINGB,  BRINGF,  OPEN,
     69     KC_LSFT, COPY, PAST, KC_Z,  KC_C,   KC_V,   KC_B,   KC_LBRC, KC_RBRC, AI
     70   ),
     71 
     72   // Illustrator layer
     73   [_AI] = LAYOUT_ortho_3x10(
     74     _______, MACRO_0, RULER,   _______, KC_G,    _______, _______, KC_Q,  KC_MINS, KC_PLUS,
     75     _______, _______, _______, KC_E,    _______, _______, _______, SHAPE, KC_O,    OPEN,
     76     _______, _______, _______, _______, _______, _______, _______, KC_M,  KC_SLSH, PR
     77   ),
     78 
     79   // Premiere layer
     80   [_PR] = LAYOUT_ortho_3x10(
     81     _______, KC_Q,  KC_W,   KC_I,   KC_O, KC_P, IMPORT, EXPORT,  KC_MINS,  KC_EQL,
     82     _______, REDO,  KC_D,   KC_F,   KC_H, KC_M, KC_ENT, KC_LBRC, KC_RBRC,  OPEN,
     83     _______, PCOPY, PPASTE, KC_SPC, KC_Z, KC_C, KC_V,   KC_LEFT, KC_RIGHT, XD
     84   ),
     85 
     86   // Experience Design layer
     87   [_XD] = LAYOUT_ortho_3x10(
     88     _______, KC_E,    KC_R,  KC_T,  KC_P, KC_A, KC_L, KC_V, KC_DEL, NEW,
     89     _______, REDO,    GROUP, UNGRP, VIEW, HORZ, VERT, KC_Z, KC_ENT, OPEN,
     90     _______, KC_LCTL, COPY,  PAST,  SYMB, LOCK, MASK, HIDE, REPEAT, PS
     91   ),
     92 
     93 };
     94 
     95 void persistent_default_layer_set(uint16_t default_layer) {
     96   eeconfig_update_default_layer(default_layer);
     97   default_layer_set(default_layer);
     98 }
     99 
    100 void matrix_init_user(void) {
    101   rgblight_enable();
    102 }
    103 
    104 void matrix_scan_user(void) {
    105   #ifdef RGBLIGHT_ENABLE
    106 
    107   static uint8_t old_layer = 255;
    108   uint8_t new_layer = biton32(layer_state);
    109 
    110   // Color of the Icons.
    111   if (old_layer != new_layer) {
    112     switch (new_layer) {
    113       case _PS:
    114         // #31C5F0
    115         rgblight_setrgb(49, 197, 240);
    116       break;
    117       case _AI:
    118         // #FF8011
    119         rgblight_setrgb(255, 128, 17);
    120       break;
    121       case _PR:
    122         // #E788FF
    123         rgblight_setrgb(231, 136, 255);
    124       break;
    125       case _XD:
    126         // #FF2BC2
    127         rgblight_setrgb(255, 43, 194);
    128       break;
    129     }
    130     old_layer = new_layer;
    131   }
    132   #endif
    133 }
    134 
    135 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    136 	if (record->event.pressed) {
    137 		switch(keycode) {
    138 			case MACRO_0:
    139         // Save for Web Macro.
    140 				SEND_STRING(SS_LSFT(SS_LALT(SS_LCTRL("s"))));
    141 				return false;
    142 		}
    143 	}
    144 	return true;
    145 };