summaryrefslogtreecommitdiff
path: root/geeboard_firmware/qmk/keymaps/bone2planck/keymap.c
blob: 26ff9d02cb63b966836df5e7be481bb8509da182 (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
#include QMK_KEYBOARD_H
#include "keymap_german.h"

// for intellisense, has to be commented for building
/*
#include "..\..\..\..\quantum\keymap_extras\keymap_german.h"
#include "..\..\..\..\tmk_core\common\keycode.h"
*/

/* This Layout tries to emulate the Bone2 Variant of Neo2, and is intended to be used with a German QWERTZ Softwarelayout.
It has "üäöß" as it is optimized for a mix of German & English.
My favourite features are the placement of the special characters often used for programming right on the home row
and the number & navigation block combo, so you never have to move your hands from their home position.

Bone2 wiki page: http://wiki.neo-layout.org/wiki/Bone
*/
enum custom_keycodes {
    CC_MS_BTN1 = SAFE_RANGE,
    CC_MS_BTN2,
    CC_MS_BTN3,
};

void pointing_device_init_user(void) {
    set_auto_mouse_layer(6); // only required if AUTO_MOUSE_DEFAULT_LAYER is not set to index of <mouse_layer>
    set_auto_mouse_enable(true);         // always required before the auto mouse feature will work
}

bool is_middle_click = false;
bool is_left_click = false;
bool is_right_clicK = false;

// Modify these values to adjust the scrolling speed
#define SCROLL_DIVISOR_H 8.0
#define SCROLL_DIVISOR_V 8.0

// Variables to store accumulated scroll values
float scroll_accumulated_h = 0;
float scroll_accumulated_v = 0;

report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) {
    if (is_middle_click) {
        // Calculate and accumulate scroll values based on mouse movement and divisors
        scroll_accumulated_h += (float)mouse_report.x / SCROLL_DIVISOR_H;
        scroll_accumulated_v += (float)mouse_report.y / SCROLL_DIVISOR_V;

        // Assign integer parts of accumulated scroll values to the mouse report
        mouse_report.h = (int8_t)scroll_accumulated_h;
        mouse_report.v = (int8_t)scroll_accumulated_v;

        // Update accumulated scroll values by subtracting the integer parts
        scroll_accumulated_h -= (int8_t)scroll_accumulated_h;
        scroll_accumulated_v -= (int8_t)scroll_accumulated_v;

        // Clear the X and Y values of the mouse report
        mouse_report.x = 0;
        mouse_report.y = 0;
    }
    return mouse_report;
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    report_mouse_t currentReport = pointing_device_get_report();
    if (keycode == CC_MS_BTN1) {
       currentReport.buttons = record->event.pressed;
    }
    if (keycode == CC_MS_BTN2) {
        is_right_clicK = record->event.pressed;
    }
    if (keycode == CC_MS_BTN3) {
        is_middle_click = record->event.pressed;
    }
    return true;
}

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

/* Bone2 (adapted)
* ,-----------------------------------------------------------------------------------.
* | ß    |   J  |   D  |   U  |   A  |   X  |   P  |   H  |   L  |   M  |   W  |  Q   |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* |  M1  |   C  |   T  |   I  |   E  |   O  |   B  |   N  |   R  |   S  |   G  |M1/Ent|  //hold for M1, tap for Enter
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift|   F  |   V  |   Ü  |   Ä  |   Ö  |   Y  |   Z  |   ,  |   .  |   K  |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | GUI  | Alt  |  M4  |  M2  |    Space    |  M2  |  M4  | Alt  | Esc  | Ctrl |
* `-----------------------------------------------------------------------------------'
*/
// columnt -t -o' '
[0] = LAYOUT_ortho_4x12(
//            MO(1),   DE_C,    DE_T,    DE_I,    DE_E,    DE_O,    DE_B,   DE_N,    DE_R,    DE_S,    DE_G,        LT(1,KC_ENT) ,
//            KC_LCTL, KC_LGUI, KC_LALT, MO(4),   MO(2),   KC_SPC,  KC_SPC, MO(2),   MO(4),   KC_RALT, KC_ESC,      KC_RCTL
    DE_SS,               DE_J,    DE_D,    DE_U,    DE_A,    DE_X,    DE_P,    DE_H,   DE_L,    DE_M,    DE_W,  DE_Q         ,
    LT(1,KC_TAB),        DE_C,    DE_T,    DE_I,    DE_E,    DE_O,    DE_B,    DE_N,   DE_R,    DE_S,    DE_G,  LT(1,KC_ENT) ,
    MT(MOD_LSFT,KC_ESC), DE_F,    DE_V,    DE_UDIA, DE_ADIA, DE_ODIA, DE_Y,    DE_Z,   DE_COMM, DE_DOT,  DE_K,  KC_LSFT      ,
    KC_LCTL,             KC_LALT, KC_LGUI, MO(2),   KC_SPC,  XXXXXXX, XXXXXXX, KC_ENT, MO(4),   KC_RALT, TG(7), KC_RCTL
),

/* M1 Special Characters
*  very ergonomic placement for coding
* ,-----------------------------------------------------------------------------------.
* | °    |   @  |   _  |   [  |   ]  |   ^  |   !  |   <  |   >  |   =  |   &  |  ´   |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* |  M1  |   \  |   /  |   {  |   }  |   *  |   ?  |   (  |   )  |   -  |   :  |M1/Ent|  //hold for M1, tap for Enter
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift|   #  |   ~  |   |  |   $  |   €  |   +  |   %  |   "  |   '  |   ;  |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | GUI  | Alt  |  M4  |  M2  |    Space    |  M2  |  M4  | Alt  | Esc  | Ctrl |
* `-----------------------------------------------------------------------------------'
*/
[1] = LAYOUT_ortho_4x12(
     DE_DEG,  DE_AT,   DE_UNDS, DE_LBRC, DE_RBRC, DE_CIRC, DE_EXLM, DE_LABK, DE_RABK, DE_EQL,  DE_AMPR, DE_ACUT ,
     _______, DE_BSLS, DE_SLSH, DE_LCBR, DE_RCBR, DE_ASTR, DE_QUES, DE_LPRN, DE_RPRN, DE_MINS, DE_COLN, _______ ,
     _______, DE_HASH, DE_TILD, DE_PIPE, DE_DLR,  DE_EURO, DE_PLUS, DE_PERC, DE_DQUO, DE_QUOT, DE_SCLN, _______ ,
     _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),

/* M2 Navigation & Number Blocks
*  very easy to get used to & intuituve placement
* ,-----------------------------------------------------------------------------------.
* |      | PgUp | Bksp |  Up  |  DEL | PgDn |      |   7  |   8  |   9  |      | Ins  |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* |  Tab | Home |  Lft | Down | Right| End  |      |   4  |   5  |   6  |   .  | Enter|
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift|      |  Tab |      | Enter|      |   0  |   1  |   2  |   3  |   ,  |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | GUI  | Alt  |  M3  |  M2  |    Space    |  M2  |  M3  | Alt  | Esc  | Ctrl |
* `-----------------------------------------------------------------------------------'
*/
[2] = LAYOUT_ortho_4x12(
     XXXXXXX, KC_PGUP, KC_BSPC, KC_UP,   KC_DEL,  KC_PGDN, XXXXXXX, DE_7,    DE_8,  DE_9,    XXXXXXX, KC_INS  ,
     KC_TAB,  KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END,  XXXXXXX, DE_4,    DE_5,  DE_6,    DE_DOT,  KC_ENT  ,
     _______, XXXXXXX, KC_TAB,  XXXXXXX, KC_ENT,  XXXXXXX, DE_0,    DE_1,    DE_2,  DE_3,    DE_COMM, _______ ,
     _______, _______, _______, MO(3),   _______, _______, _______, _______, MO(3), _______, _______, _______
),

/* M3 Switched Navigation & Number Blocks for one handed use
*  accessed by sliding from M2 to M3 with thumb
* ,-----------------------------------------------------------------------------------.
* |  Ins |      |  7   |  8   |  9   |      | PgUp | Bksp |  Up  |  DEL | PgDn |      |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* |  Tab |      |  4   |  5   |  6   |   .  | Home | Left | Down | Right| End  | Enter|
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift|  0   |  1   |  2   |  3   |   ,  |      | Tab  |      | Enter|      |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | GUI  | Alt  |  M3  |      |    Space    |      |  M3  | Alt  | Esc  | Ctrl |
* `-----------------------------------------------------------------------------------'
*/

[3] = LAYOUT_ortho_4x12(
     KC_INS,  XXXXXXX, DE_7,    DE_8,    DE_9,    XXXXXXX, KC_PGUP, KC_BSPC, KC_UP,   KC_DEL,  KC_PGDN, XXXXXXX ,
     _______, XXXXXXX, DE_4,    DE_5,    DE_6,    DE_DOT,  KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END,  _______ ,
     _______, DE_0,    DE_1,    DE_2,    DE_3,    DE_COMM, XXXXXXX, KC_TAB,  XXXXXXX, KC_ENT,  XXXXXXX, _______ ,
     _______, _______, _______, _______, XXXXXXX, _______, _______, XXXXXXX, _______, _______, _______, _______
),


/* M4 Function & Media Keys
* ,-----------------------------------------------------------------------------------.
* |      |      | Print|Scroll|Pause |      |      |  F7  |  F8  |  F9  |  F12 |      |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Tab  |      | Mute | Vol- | Vol+ |      |   ³  |  F4  |  F5  |  F6  |  F11 | Enter|
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift|      | Prev | Play | Next |      |   ²  |  F1  |  F2  |  F3  |  F10 |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | GUI  | Alt  |  M4  |  M5  |    Space    |  M5  |  M4  | Alt  | Esc  | Ctrl |
* `-----------------------------------------------------------------------------------'
*/
[4] = LAYOUT_ortho_4x12(
     XXXXXXX, XXXXXXX, KC_PSCR, KC_SCRL, KC_PAUS, XXXXXXX, XXXXXXX, KC_F7, KC_F8,   KC_F9,   KC_F12,  XXXXXXX ,
     KC_TAB,  XXXXXXX, KC_MUTE, KC_VOLD, KC_VOLU, XXXXXXX, DE_SUP3, KC_F4, KC_F5,   KC_F6,   KC_F11,  KC_ENT  ,
     _______, XXXXXXX, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, DE_SUP2, KC_F1, KC_F2,   KC_F3,   KC_F10,  _______ ,
     _______, _______, _______, _______, MO(5),   _______, _______, MO(5), _______, _______, _______, _______
),


/* M5 Switched Function & Media Keys|
*  accessed by sliding from M4 to M5 with thumb
* ,-----------------------------------------------------------------------------------.
* |      |      |  F7  |  F8  |  F9  |  F12 |      | Print|Scroll| Pause|      |      |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Tab  |  ³   |  F4  |  F5  |  F6  |  F11 |      | Mute | Vol- | Vol+ |      | Enter|
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift|  ²   |  F1  |  F2  |  F3  |  F10 |      | Prev | Play | Next |      |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | GUI  | Alt  |      |  M5  |    Space    |  M5  |      | Alt  | Esc  | Ctrl |
* `-----------------------------------------------------------------------------------'
*/
[5] = LAYOUT_ortho_4x12(
     XXXXXXX, XXXXXXX, KC_F7,   KC_F8,   KC_F9,   KC_F12,  XXXXXXX, KC_PSCR, KC_SCRL, KC_PAUS, XXXXXXX, XXXXXXX ,
     _______, DE_SUP3, KC_F4,   KC_F5,   KC_F6,   KC_F11,  XXXXXXX, KC_MUTE, KC_VOLD, KC_VOLU, XXXXXXX, _______ ,
     _______, DE_SUP2, KC_F1,   KC_F2,   KC_F3,   KC_F10,  XXXXXXX, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, _______ ,
     _______, _______, _______, XXXXXXX, _______, _______, _______, _______, XXXXXXX, _______, _______, _______
),
[6] = LAYOUT_ortho_4x12(
     _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
     _______, _______, _______, _______, _______, _______, _______, MS_BTN1, MS_BTN2, MS_BTN3, _______, _______,
     _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
     _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
[7] = LAYOUT_ortho_4x12(
    MI_C,    MI_Cs,   MI_D,    MI_Ds,   MI_E,    MI_F,    MI_Fs,   MI_G,    MI_Gs,   MI_A,    MI_As,   MI_B,
    MI_C1,   MI_Cs1,  MI_D1,   MI_Ds1,  MI_E1,   MI_F1,   MI_Fs1,  MI_G1,   MI_Gs1,  MI_A1,   MI_As1,  MI_B1,
    MI_C2,   MI_Cs2,  MI_D2,   MI_Ds2,  MI_E2,   MI_F2,   MI_Fs2,  MI_G2,   MI_Gs2,  MI_A2,   MI_As2,  MI_B2,
    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, MI_TOGG
),
};