summaryrefslogtreecommitdiffstats
path: root/keyboards/keebio/iris/keymaps/hag/keymap.c
blob: 222b68208f779e7fb18d063063ed1d13c3ecab62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
#include "iris.h"
#include "action_layer.h"
#include "eeconfig.h"

extern keymap_config_t keymap_config;


//Heavily modified keymap. Some features:
//Multiple layouts, I use dvorak as main.
//Nordic(swedish) signs
//Symbols, numpad, arrows/navigation reachable under the alpas via the layers
//Mirrored ctl, alt and shift to be able to use both hands when doing commands
//Gaming layer, qwerty with space on left half.

#define _QWERTY 2
#define _DVORAK 0
#define _COLEMAK 1
#define _WORKMAN 3
#define _GAMING 4
#define _NUMPAD 5
#define _LOWER 6
#define _RAISE 7

#define _ADJUST 16

enum custom_keycodes {
  QWERTY = SAFE_RANGE,
  DVORAK,
  COLEMAK,
  WORKMAN,
  GAMING,
  NUMPAD,
  LOWER,
  RAISE,
  ADJUST,
};

#define KC_ KC_TRNS

#define KC_Sw2 RALT(KC_2) // Nordic @
#define KC_Sw3 RALT(KC_3) // Nordic something
#define KC_Sw4 RALT(KC_4) // Nordic something
#define KC_Sw5 RALT(KC_5) // Nordic something
#define KC_Sw6 RALT(KC_6) // ...
#define KC_Sw7 RALT(KC_7)
#define KC_Sw8 RALT(KC_8)
#define KC_Sw9 RALT(KC_9)
#define KC_Sw0 RALT(KC_0)
#define KC_Tild RALT(KC_RBRC)
#define KC_Bsls RALT(KC_MINS)
#define KC_Bar RALT(KC_NUBS)
#define KC_Less S(KC_NUBS)
#define KC_CATDEL LCTL(LALT(KC_DEL)) // Ctrl alt del
#define KC_TSKMGR LCTL(S(KC_ESC)) // Ctrl shift esc
#define KC_NUMP TG(_NUMPAD)  // Toggle layer NUMPAD for use in LAYOUT_kc
#define KC_Close RALT(KC_F4) // Alt F4
#define KC_Great S(KC_NUBS)
#define KC_MEH1 MEH(KC_1)
#define KC_MEH2 MEH(KC_2)
#define KC_MEH3 MEH(KC_3)
#define KC_MEH4 MEH(KC_4)
#define KC_MEH5 MEH(KC_5)

#define KC_LOWR LOWER
#define KC_RASE RAISE
#define KC_RST RESET
#define KC_BL_S BL_STEP

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

  [_QWERTY] = LAYOUT_kc(
  //,----+----+----+----+----+----.              ,----+----+----+----+----+----.
     DEL ,APP, VOLD,MUTE,VOLU,LGUI,               RGUI,MPRV,MPLY,MNXT,DOWN,ESC ,
  //|----+----+----+----+----+----|              |----+----+----+----+----+----|
     TAB , Q  , W  , E  , R  , T  ,                Y  , U  , I  , O  , P  ,LBRC,
  //|----+----+----+----+----+----|              |----+----+----+----+----+----|
     LCTL, A  , S  , D  , F  , G  ,                H  , J  , K  , L  ,SCLN,QUOT,
  //|----+----+----+----+----+----+----.    ,----|----+----+----+----+----+----|
     LSFT, Z  , X  , C  , V  , B  ,NUMP,     ENT , N  , M  ,COMM,DOT ,SLSH,RSFT,
  //`----+----+----+--+-+----+----+----/    \----+----+----+----+----+----+----'
                       LALT,LOWR,BSPC,         SPC ,RASE,LALT
  //                  `----+----+----'        `----+----+----'
  ),

  [_GAMING] = LAYOUT_kc(
  //,----+----+----+----+----+----.              ,----+----+----+----+----+----.
     ESC , 1  , 2  , 3  , 4  , 5  ,                6  , 7  , 8  , 9  , 0  ,ESC ,
  //|----+----+----+----+----+----|              |----+----+----+----+----+----|
     TAB , Q  , W  , E  , R  , T  ,                Y  , U  , I  , O  , P  ,DEL,
  //|----+----+----+----+----+----|              |----+----+----+----+----+----|
     LCTL, A  , S  , D  , F  , G  ,                H  , J  , K  , L  ,SCLN,RCTL,
  //|----+----+----+----+----+----+----.    ,----|----+----+----+----+----+----|
     LSFT, Z  , X  , C  , V  , B  , Y  ,     ENT , N  , M  ,COMM,DOT ,SLSH,RSFT,
  //`----+----+----+--+-+----+----+----/    \----+----+----+----+----+----+----'
                       LALT,LOWR,SPC,         BSPC ,RASE,LALT
  //                  `----+----+----'        `----+----+----'
  ),

 [_DVORAK] = LAYOUT_kc(
  //,----+----+----+----+----+----.              ,----+----+----+----+----+----.
     DEL ,APP ,VOLD,MUTE,VOLU,LGUI,               RGUI,MPRV,MPLY,MNXT,DOWN,ESC ,
  //,----+----+----+----+----+----.              ,----+----+----+----+----+----.
     TAB ,LBRC,QUOT,SCLN, P  , Y  ,                F  , G  , C  , R  , L  ,DEL,
  //,----+----+----+----+----+----.              ,----+----+----+----+----+----.
     LCTL, A  , O  , E  , U  , I  ,                D  , H  , T  , N  , S  ,RCTL,
  //,----+----+----+----+----+----.              ,----+----+----+----+----+----.
     LSFT,DOT , Q  , J  , K  , X  ,NUMP,     ENT , B  , M  , W  , V  , Z  ,RSFT,
  //,----+----+----+----+----+----.              ,----+----+----+----+----+----.
                       LALT,LOWR,BSPC,         SPC ,RASE,LALT
  //                  `----+----+----'        `----+----+----'
  ),

 [_COLEMAK] = LAYOUT_kc(
  //,----+----+----+----+----+----.              ,----+----+----+----+----+----.
     DEL ,APP, VOLD,MUTE,VOLU,LGUI,               RGUI,MPRV,MPLY,MNXT,DOWN,ESC ,
  //|----+----+----+----+----+----|              |----+----+----+----+----+----|
     TAB , Q  , W  , F  , P  , G  ,                J  , L  , U  , Y  ,LBRC,QUOT,
  //|----+----+----+----+----+----|              |----+----+----+----+----+----|
     LCTL, A  , R  , S  , T  , D  ,                H  , N  , E  , I  , O  ,SCLN,
  //|----+----+----+----+----+----+----.    ,----|----+----+----+----+----+----|
     LSFT, Z  , X  , C  , V  , B  ,NUMP,     ENT , K  , M  ,COMM, DOT,SLSH,RSFT,
  //`----+----+----+--+-+----+----+----/    \----+----+----+----+----+----+----'
                       LALT,LOWR,BSPC,         SPC ,RASE,LALT
  //                  `----+----+----'        `----+----+----'
  ),

[_WORKMAN] = LAYOUT_kc(
  //,----+----+----+----+----+----.              ,----+----+----+----+----+----.
     DEL ,APP, VOLD,MUTE,VOLU,LGUI,               RGUI,MPRV,MPLY,MNXT,DOWN,ESC ,
  //|----+----+----+----+----+----|              |----+----+----+----+----+----|
     TAB , Q  , W  , R  , W  , B  ,                J  , F  , U  , P  ,LBRC,SCLN,
  //|----+----+----+----+----+----|              |----+----+----+----+----+----|
     LCTL, A  , S  , H  , T  , G  ,                Y  , N  , E  , O  , I  ,RCTL,
  //|----+----+----+----+----+----+----.    ,----|----+----+----+----+----+----|
     LSFT, Z  , X  , M  , C  , V  ,NUMP,     ENT , K  , L  ,QUOT, DOT,SLSH,RSFT,
  //`----+----+----+--+-+----+----+----/    \----+----+----+----+----+----+----'
                       LALT,LOWR,BSPC,         SPC ,RASE,LALT
  //                  `----+----+----'        `----+----+----'
  ),

  [_NUMPAD] = LAYOUT_kc(
  //,----+----+----+----+----+----.              ,----+----+----+----+----+----.
     F1  , F2 , F3 , F4 , F5 , F6 ,                F7 , F8 , F9 ,F10 ,F11 ,F12 ,
  //|----+----+----+----+----+----|              |----+----+----+----+----+----|
         ,MEH1,BTN2,MS_U,BTN1,CATDEL,             PIPE, P7 , P8 , P9 ,SLSH,    ,
  //|----+----+----+----+----+----|              |----+----+----+----+----+----|
         ,MEH4,MS_L,MS_D,MS_R,TSKMGR,             COMM, P4 , P5 , P6 ,MINS,    ,
  //|----+----+----+----+----+----+----.    ,----|----+----+----+----+----+----|
         ,MEH5,ACL0,ACL1,ACL2,MEH3,    ,     PENT,DOT , P1 , P2 , P3 , P0 ,    ,
  //`----+----+----+--+-+----+----+----/    \----+----+----+----+----+----+----'
                       LALT,LOWR,BSPC,             , P0 ,NLCK
  //                  `----+----+----'        `----+----+----'
  ),


  [_LOWER] = LAYOUT_kc(
  //,----+----+----+----+----+----.              ,----+----+----+----+----+----.
     F1  , F2 , F3 , F4 , F5 , F6 ,                F7 , F8 , F9 ,F10 ,F11 ,F12 ,
  //|----+----+----+----+----+----|              |----+----+----+----+----+----|
         ,CAPS,PGUP, UP ,PGDN, ESC,               RCBR,EXLM,ASTR,LPRN,UNDS,    ,
  //|----+----+----+----+----+----|              |----+----+----+----+----+----|
         ,HOME,LEFT,DOWN,RGHT, END,               RPRN,QUES,Sw8 ,Sw9 ,LABK,    ,
  //|----+----+----+----+----+----+----.    ,----|----+----+----+----+----+----|
         , ENT,    ,    ,    , DEL,    ,         ,RABK,NUBS,Sw7 ,Sw0 ,Great,   ,
  //`----+----+----+--+-+----+----+----/    \----+----+----+----+----+----+----'
                           ,    ,   ,            ,    ,
  //                  `----+----+----'        `----+----+----'
  ),

  [_RAISE] = LAYOUT_kc(
  //,----+----+----+----+----+----.              ,----+----+----+----+----+----.
     TILD,EXLM,GRV ,EQL, DLR ,PERC,               Sw3 ,Sw5 ,Sw6 ,Sw0 ,RPRN,    ,
  //|----+----+----+----+----+----|              |----+----+----+----+----+----|
         ,Bar ,Sw2 ,HASH, AT ,PERC,               PIPE, 7  , 8  , 9  ,PMNS,PSLS,
  //|----+----+----+----+----+----|              |----+----+----+----+----+----|
         ,Bsls,Tild,SLSH,AMPR,BSLS,               COMM, 4  , 5  , 6  ,PPLS,PAST,
  //|----+----+----+----+----+----+----.    ,----|----+----+----+----+----+----|
         ,PIPE,Sw4 ,PLUS,CIRC,TILD,    ,     PENT,DOT , 1  , 2  , 3  , 0  ,PEQL,
  //`----+----+----+--+-+----+----+----/    \----+----+----+----+----+----+----'
                           ,    ,DEL ,             ,    ,
  //                  `----+----+----'        `----+----+----'
  ),

  [_ADJUST] = LAYOUT(
  //,--------+--------+--------+--------+--------+--------.                          ,--------+--------+--------+--------+--------+--------.
      GAMING , DVORAK,  WORKMAN, COLEMAK, QWERTY ,   KC_RST,                           _______, _______, _______, _______, KC_PWR,    RESET,
  //|--------+--------+--------+--------+--------+--------|                          |--------+--------+--------+--------+--------+--------|
      _______, _______, _______,LGUI(KC_UP),_______,LALT(KC_F4),                       _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI,
  //|--------+--------+--------+--------+--------+--------|                          |--------+--------+--------+--------+--------+--------|
      _______, _______,LGUI(KC_LEFT),LGUI(KC_DOWN),LGUI(KC_RGHT),_______,             _______,  DEBUG  , RGB_HUD, RGB_SAD, RGB_VAD, BL_STEP,
  //|--------+--------+--------+--------+--------+--------+--------.        ,--------|--------+--------+--------+--------+--------+--------|
      _______, _______, _______, _______, _______, _______, _______,          _______, _______, _______, _______, _______, _______, _______,
  //`--------+--------+--------+----+---+--------+--------+--------/        \--------+--------+--------+---+----+--------+--------+--------'
                                      _______, _______, _______,                  _______, _______, _______
  //                                `--------+--------+--------'                `--------+--------+--------'
  )

};

#ifdef AUDIO_ENABLE
float tone_qwerty[][2]     = SONG(QWERTY_SOUND);
#endif

void persistent_default_layer_set(uint16_t default_layer) {
  eeconfig_update_default_layer(default_layer);
  default_layer_set(default_layer);
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  switch (keycode) {
    case QWERTY:
      if (record->event.pressed) {
        #ifdef AUDIO_ENABLE
          PLAY_SONG(tone_qwerty);
        #endif
        persistent_default_layer_set(1UL<<_QWERTY);
      }
      return false;
      break;
    case DVORAK:
      if (record->event.pressed) {
        #ifdef AUDIO_ENABLE
//          PLAY_SONG(tone_qwerty);
        #endif
        persistent_default_layer_set(1UL<<_DVORAK);
      }
      return false;
      break;
    case NUMPAD:
      if (record->event.pressed) {
        #ifdef AUDIO_ENABLE
//          PLAY_SONG(tone_qwerty);
        #endif
        persistent_default_layer_set(1UL<<_NUMPAD);
      }
      return false;
      break;
    case COLEMAK:
      if (record->event.pressed) {
        #ifdef AUDIO_ENABLE
//          PLAY_SONG(tone_qwerty);
        #endif
        persistent_default_layer_set(1UL<<_COLEMAK);
      }
      return false;
      break;
    case WORKMAN:
      if (record->event.pressed) {
        #ifdef AUDIO_ENABLE
//          PLAY_SONG(tone_qwerty);
        #endif
        persistent_default_layer_set(1UL<<_WORKMAN);
      }
      return false;
      break;
    case GAMING:
      if (record->event.pressed) {
        #ifdef AUDIO_ENABLE
//          PLAY_SONG(tone_qwerty);
        #endif
        persistent_default_layer_set(1UL<<_GAMING);
      }
      return false;
      break;
    case LOWER:
      if (record->event.pressed) {
        layer_on(_LOWER);
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
      } else {
        layer_off(_LOWER);
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
      }
      return false;
      break;
    case RAISE:
      if (record->event.pressed) {
        layer_on(_RAISE);
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
      } else {
        layer_off(_RAISE);
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
      }
      return false;
      break;
    case ADJUST:
      if (record->event.pressed) {
        layer_on(_ADJUST);
      } else {
        layer_off(_ADJUST);
      }
      return false;
      break;
  }
  return true;
}