summaryrefslogtreecommitdiff
path: root/users/rupa/process_records.c
blob: 2d23e3401766d8a4e8056b8322c5ca1308bb808c (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
/*
Copyright 2020 rupa <rupa@lrrr.us> @rupa

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "rupa.h"

uint16_t processed_keycode;

__attribute__((weak))
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
    return true;
}

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    if (record->event.pressed) {

        processed_keycode = keycode;
        // mask out mod taps
        if (
            (keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) ||
            (keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX)
        ) {
            processed_keycode &= 0xFF;
        }

        bool is_shifted = (get_mods() | get_oneshot_mods() | get_weak_mods()) & MOD_MASK_SHIFT;
        switch(processed_keycode) {
            case VRSN:
                send_string_with_delay_P(PSTR(
                    "# " QMK_KEYBOARD "/" QMK_KEYMAP ":" QMK_VERSION " " QMK_BUILDDATE "\n"
                ), TAP_CODE_DELAY);
                return false;

            case BUGS:
                return u_xp(is_shifted, "ᙙᙖ", "ଳ");
            case CATS:
                return u_xp(is_shifted, "ⓛ ᆽ ⓛ ", "ㅇㅅㅇ");
            case DANCE:
                return u_x(dance(is_shifted));
            case DICE:
                return u_x(d6());
            case DOMO:
                return u_xp(is_shifted, "(シ_ _)シ", "m(_ _)m");
            case FART:
                return u_x("⊥ʶ∀Ⅎ");
            case FLIP:
                return u_x(flip(is_shifted));
            case HUGS:
                return u_xp(is_shifted, "(づ ̄ ³ ̄)づ", "(っಠ‿ಠ)っ");
            case JOY:
                return u_x(joy(is_shifted));
            case RNDM:
                return false;
            case KISS:
                return u_xp(is_shifted, "꒒ ০ ⌵ ୧ ♡", "( ˘ ³˘)♥");
            case LOD:
                return u_xp(is_shifted, "( ͡ಠ ʖ̯ ͡ಠ)", "ಠ_ಠ");
            case MUSIC:
                return u_xp(is_shifted, "(˳˘ ɜ˘)˳ ♬ ♪♫", "(´▽`)ノ♫");
            case RUPA:
                return u_xp(is_shifted, "Śrīrūpa", "rūpa");
            case SHRUG:
                return u_xp(is_shifted, "⋌ ༼ •̀ ⌂ •́ ༽⋋", "¯\\_(ツ)_/¯");
            case TADA:
                return u_xp(is_shifted, "☆ *・゜゚・*(^O^)/*・゜゚・*☆", "\\(゜ロ\\)Ξ(//ロ゜)//");
            case WAT:
                return u_xp(is_shifted, "༼  ຶཽཀ  ຶཽ༽", "ヽ༼⊙_⊙༽ノ");
            case YUNO:
                return u_xp(is_shifted, "o(^^o)", "щ(゜ロ゜щ)");
            case ZALGO:
                set_combined_mode(CM_ZALGO);
                break;
            case ZZZZZ:
                cycle_combined_mode();
                break;

#if defined(UNICODE_SCRIPT_MODE_ENABLE)
            // script modes
            case U_FRACT:
                return set_script_mode(F_FRACT);
            case U_ITALI:
                return set_script_mode(F_ITALI);
            case U_MONOS:
                return set_script_mode(F_MONOS);
            case U_NORML:
                return set_script_mode(F_NORML);
            case U_SANSI:
                return set_script_mode(F_SANSI);
            case U_SANSN:
                return set_script_mode(F_SANSN);
            case U_SCRPT:
                return set_script_mode(F_SCRPT);

            default:
                if (get_script_mode() != NULL) {
                    return script_mode_translate(is_shifted, processed_keycode);
                }
                if (combined_mode != CM_NULL && combined_text(processed_keycode)) {
                    return false;
                }
#endif
            }
    }
    return process_record_keymap(keycode, record);
}