summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Grosse <ste3ls@gmail.com>2020-10-29 09:26:15 +0100
committerGitHub <noreply@github.com>2020-10-29 01:26:15 -0700
commitdb9204c7e1d1da9ba041aa34a50e92083d5726e9 (patch)
tree6db387533aa60e402db334f8f999b45e8b96fc10
parent27b80468670d5895a8ccb2d9603ffae325fe900a (diff)
[Keymap] add an autoclicker to my plaid keymap (#10743)
-rw-r--r--keyboards/dm9records/plaid/keymaps/gipsy-king/keymap.c31
-rw-r--r--keyboards/dm9records/plaid/keymaps/gipsy-king/readme.md2
2 files changed, 31 insertions, 2 deletions
diff --git a/keyboards/dm9records/plaid/keymaps/gipsy-king/keymap.c b/keyboards/dm9records/plaid/keymaps/gipsy-king/keymap.c
index c02c622441..0abd3f8495 100644
--- a/keyboards/dm9records/plaid/keymaps/gipsy-king/keymap.c
+++ b/keyboards/dm9records/plaid/keymaps/gipsy-king/keymap.c
@@ -15,6 +15,7 @@
*/
#include QMK_KEYBOARD_H
+#include "mousekey.h"
enum plaid_layers {
@@ -25,9 +26,13 @@ enum plaid_layers {
};
enum plaid_keycodes {
- QWERTY = SAFE_RANGE
+ AUTOCLICK = SAFE_RANGE
};
+static bool autoclick = false;
+static bool autoclick_state = false;
+static uint16_t autoclick_timer = 0;
+
#define XMONAD LM(_XMONAD, MOD_LGUI)
#define SPC_LWR LT(_LOWER, KC_SPACE)
#define ENT_RSE LT(_RAISE, KC_ENT)
@@ -89,7 +94,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
_______, _______, MU_MOD, AU_ON, AU_OFF, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, RESET,
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF,_______, _______, _______,
- _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
+ _______, _______, _______, _______, _______, _______, _______, _______, _______, XXXXXXX, _______, AUTOCLICK
)
};
@@ -167,6 +172,16 @@ void matrix_scan_user(void) {
break;
}
}
+ if (autoclick && timer_elapsed(autoclick_timer) > (autoclick_state ? 20 : 100)) {
+ if (!autoclick_state) {
+ mousekey_on(KC_MS_BTN1);
+ } else {
+ mousekey_off(KC_MS_BTN1);
+ }
+ mousekey_send();
+ autoclick_state = !autoclick_state;
+ autoclick_timer = timer_read();
+ }
}
layer_state_t layer_state_set_user(layer_state_t state) {
@@ -186,3 +201,15 @@ layer_state_t layer_state_set_user(layer_state_t state) {
}
return state;
}
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ switch (keycode) {
+ case AUTOCLICK:
+ if (record->event.pressed) {
+ autoclick = !autoclick;
+ autoclick_timer = timer_read();
+ }
+ break;
+ }
+ return true;
+};
diff --git a/keyboards/dm9records/plaid/keymaps/gipsy-king/readme.md b/keyboards/dm9records/plaid/keymaps/gipsy-king/readme.md
index 1dc2bba12a..999d92c844 100644
--- a/keyboards/dm9records/plaid/keymaps/gipsy-king/readme.md
+++ b/keyboards/dm9records/plaid/keymaps/gipsy-king/readme.md
@@ -15,3 +15,5 @@ old machine.
When any layer is active, the LEDs are "startled".
+There is an autoclicker for minecraft.
+