aboutsummaryrefslogtreecommitdiffstats
path: root/users/brett/brett.c
blob: c19c8b4a8a074072f5b03b8e2aa807332e403543 (plain) (blame)
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
#include "brett.h"

char * get_key(uint16_t keycode) {
    switch (keycode) {
        case FAT_ARROW:
            return "=>";
        case SKINNY_ARROW:
            return "->";
        case REVERSE_ARROW:
            return "<-";
        case CONCAT:
            return "<>";
        case MAP:
            return "<$>";
        case MAP_FLIPPED:
            return "<#>";
        case FLAP:
            return "<@>";
        case PIPE:
            return "|>";
        case ALT:
            return "<|>";
        case APPLY:
            return "<*>";
        case AND:
            return "&&";
        case OR:
            return "||";
        case BIND:
            return ">>=";
        case BIND_FLIPPED:
            return "=<<";
        case DOUBLE_COLON:
            return "::";
        case VOID_LEFT:
            return "<$";
        case VOID_RIGHT:
            return "$>";
        default:
            return "";
    }
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    bool pressed = record->event.pressed;
    switch (keycode) {
        case FAT_ARROW ... DOUBLE_COLON:
            if (pressed) {
                send_string(get_key(keycode));
            }
            return false;
        case FLASH:
            if (!pressed) {
                SEND_STRING("make -j8 --output-sync " QMK_KEYBOARD ":" QMK_KEYMAP ":flash" SS_TAP(X_ENTER));
                reset_keyboard();
            }
            return false;
        default:
            return true;
    }
}