summaryrefslogtreecommitdiff
path: root/users/miles2go/milestogo.c
diff options
context:
space:
mode:
authormilestogo <milestogo@users.noreply.github.com>2020-05-08 23:15:26 -0700
committerGitHub <noreply@github.com>2020-05-08 23:15:26 -0700
commit803610a284ac886eaeb319b4a8d25ffbd2861152 (patch)
tree46c074727b4015bdd345d762e78f89144498ce24 /users/miles2go/milestogo.c
parentcd0edbb1fba91df97be233e30c145f352eda31c0 (diff)
[Keymap] initial user directory for milestogo + babblepaste (#7698)
* initial user directory * fix missing endif in vi mode * fix includes per drashna and a few typos. I have not tested the userspace keymap, it is just there to help keep the user space and keymap in sync * move babblepaste docs to md format * clean up block quotes * TIL clang-format - miles2go userspace
Diffstat (limited to 'users/miles2go/milestogo.c')
-rw-r--r--users/miles2go/milestogo.c142
1 files changed, 142 insertions, 0 deletions
diff --git a/users/miles2go/milestogo.c b/users/miles2go/milestogo.c
new file mode 100644
index 0000000000..f1da2f4d7a
--- /dev/null
+++ b/users/miles2go/milestogo.c
@@ -0,0 +1,142 @@
+// based on drashna's but I think at this point it's a new axe
+
+#include QMK_KEYBOARD_H
+#include "milestogo.h"
+#include <print.h>
+
+__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
+
+bool move_is_on = false; // track if we are in _MOV layer
+bool sym_is_on = false; // track if we are in _SYM layer
+
+// Defines actions for global custom keycodes
+// Then runs the _keymap's record handier if not processed here
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ // static uint16_t spcmov_timer; // timer for spcmov key
+
+#ifdef USE_BABBLEPASTE
+ if (keycode > BABBLE_START && keycode < BABBLE_END_RANGE) {
+ if (record->event.pressed) { // is there a case where this isn't desired?
+ babblePaste(keycode);
+ } else {
+ return true;
+ }
+ }
+#endif
+
+ switch (keycode) {
+ case _QWERTY:
+ if (record->event.pressed) {
+ set_single_persistent_default_layer(_QWERTY);
+ }
+ break;
+
+ case _CDH:
+ if (record->event.pressed) {
+ set_single_persistent_default_layer(_CDH);
+ }
+ break;
+
+ case TMUX: // ctl-B
+ if (record->event.pressed) {
+ tap_code16(C(KC_B));
+ }
+ break;
+
+ /* Colemak mod-dh moves the D key to the qwerty V position
+ This hack makes apple-V_position do what I mean */
+ case DHPASTE:
+ if (get_mods() & MOD_BIT(KC_LGUI)) {
+ if (record->event.pressed) {
+ clear_keyboard_but_mods();
+ register_code(KC_V);
+ } else {
+ unregister_code(KC_V);
+ }
+ } else {
+ if (record->event.pressed) {
+ register_code(KC_D);
+ } else {
+ unregister_code(KC_D);
+ }
+ }
+ return false;
+ break;
+
+ default:
+ return true;
+ }
+
+ // normal keycode
+ return process_record_keymap(keycode, record);
+}
+
+void babble_led_user(void) {
+#ifdef USE_BABLPASTE
+ extern uint8_t babble_mode;
+
+# ifdef BABL_WINDOWS
+ if (babble_mode == BABL_WINDOWS_MODE) {
+ if (BABL_LED_INDEX > 0) {
+ rgblight_setrgb_at(RGBLIGHT_COLOR_MS, BABL_LED_INDEX);
+ } else {
+ rgblight_setrgb(RGBLIGHT_COLOR_MS);
+ }
+ }
+# endif
+# ifdef BABL_READMUX
+ if (babble_mode == BABL_READMUX_MODE) {
+ if (BABL_LED_INDEX > 0) {
+ rgblight_setrgb_at(RGBLIGHT_COLOR_READMUX, BABL_LED_INDEX);
+ } else {
+ rgblight_setrgb(RGBLIGHT_COLOR_READMUX);
+ }
+ }
+# endif
+# ifdef BABL_MAC
+ if (babble_mode == BABL_MAC_MODE) {
+ if (BABL_LED_INDEX > 0) {
+ rgblight_setrgb_at(RGBLIGHT_COLOR_MAC, BABL_LED_INDEX);
+ } else {
+ rgblight_setrgb(RGBLIGHT_COLOR_MAC);
+ }
+ }
+# endif
+# ifdef BABL_VI
+ if (babble_mode == BABL_VI_MODE) {
+ if (BABL_LED_INDEX > 0) {
+ rgblight_setrgb_at(RGBLIGHT_COLOR_VI, BABL_LED_INDEX);
+ } else {
+ rgblight_setrgb(RGBLIGHT_COLOR_VI);
+ }
+ }
+# endif
+# ifdef BABL_EMACS
+ if (babble_mode == BABL_EMACS_MODE) {
+ if (BABL_LED_INDEX > 0) {
+ rgblight_setrgb_at(RGBLIGHT_COLOR_EMACS, BABL_LED_INDEX);
+ } else {
+ rgblight_setrgb(RGBLIGHT_COLOR_EMACS);
+ }
+ }
+# endif
+# ifdef BABL_CHROMEOS
+ if (babble_mode == BABL_CHROMEOS_MODE) {
+ if (BABL_LED_INDEX > 0) {
+ rgblight_setrgb_at(RGBLIGHT_COLOR_CHROMEOS, BABL_LED_INDEX);
+ } else {
+ rgblight_setrgb(RGBLIGHT_COLOR_CHROMEOS);
+ }
+ }
+# endif
+# ifdef BABL_LINUX
+ if (babble_mode == BABL_LINUX_MODE) {
+ if (BABL_LED_INDEX > 0) {
+ rgblight_setrgb_at(RGBLIGHT_COLOR_LINUX, BABL_LED_INDEX);
+ } else {
+ rgblight_setrgb(RGBLIGHT_COLOR_LINUX);
+ }
+ }
+# endif
+#endif // bablepaste
+}