summaryrefslogtreecommitdiff
path: root/users/billypython
diff options
context:
space:
mode:
authorDanilo Vulicevic <danilo.vulicevic@yahoo.com>2019-02-14 21:09:27 +0100
committerDrashna Jaelre <drashna@live.com>2019-02-14 12:09:27 -0800
commit1e6797b4e7d888f0c0449e3cd577dc83eb4c4525 (patch)
tree054868cb8b176df99abdb91b3893e241727eaaf5 /users/billypython
parentce465c084bfdfb3dbd24414397b2542176da423d (diff)
[Keymap] Add my personal userspace and update my keymaps (#5128)
* Add billypython userspace and dz60 keymap * Disable Bootmagic in dz60:billypython keymap * Update whitefox:billypython keymap with userspace changes Also remove numpad layer
Diffstat (limited to 'users/billypython')
-rw-r--r--users/billypython/billypython.c32
-rw-r--r--users/billypython/billypython.h34
-rw-r--r--users/billypython/config.h19
-rw-r--r--users/billypython/rules.mk6
-rw-r--r--users/billypython/tap_dance.c33
-rw-r--r--users/billypython/tap_dance.h9
6 files changed, 133 insertions, 0 deletions
diff --git a/users/billypython/billypython.c b/users/billypython/billypython.c
new file mode 100644
index 0000000000..7bdfe33a43
--- /dev/null
+++ b/users/billypython/billypython.c
@@ -0,0 +1,32 @@
+#include "billypython.h"
+
+__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 (!process_record_keymap(keycode, record)) {
+ return false;
+ }
+
+ switch (keycode) {
+ case CLEAR:
+ if (record->event.pressed) {
+ SEND_STRING(SS_LCTRL("a") SS_TAP(X_DELETE));
+ }
+ return false;
+
+ default:
+ return true;
+ }
+}
+
+__attribute__((weak))
+uint32_t layer_state_set_keymap(uint32_t state) {
+ return state;
+}
+
+uint32_t layer_state_set_user(uint32_t state) {
+ return layer_state_set_keymap(state);
+}
diff --git a/users/billypython/billypython.h b/users/billypython/billypython.h
new file mode 100644
index 0000000000..4a444e9787
--- /dev/null
+++ b/users/billypython/billypython.h
@@ -0,0 +1,34 @@
+#pragma once
+
+#include "quantum.h"
+
+#ifdef TAP_DANCE_ENABLE
+ #include "tap_dance.h"
+#endif
+
+#ifdef LAYER_FN
+ #define FN MO(L_FN)
+ #define FN_CAPS LT(L_FN, KC_CAPS)
+ #define FN_FNLK TT(L_FN)
+#endif
+
+#define TOP LCTL(KC_HOME)
+#define BOTTOM LCTL(KC_END)
+
+enum keycodes_user {
+ CLEAR = SAFE_RANGE,
+
+ RANGE_KEYMAP,
+};
+
+enum layers_user {
+ L_BASE,
+#ifdef LAYER_FN
+ L_FN,
+#endif
+
+ L_RANGE_KEYMAP,
+};
+
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
+uint32_t layer_state_set_keymap(uint32_t state);
diff --git a/users/billypython/config.h b/users/billypython/config.h
new file mode 100644
index 0000000000..705e6c934a
--- /dev/null
+++ b/users/billypython/config.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#define FORCE_NKRO
+
+#define MAGIC_KEY_BOOTLOADER B
+
+#define MOUSEKEY_DELAY 50
+#define MOUSEKEY_INTERVAL 15
+#define MOUSEKEY_MAX_SPEED 4
+#define MOUSEKEY_TIME_TO_MAX 50
+#define MOUSEKEY_WHEEL_MAX_SPEED 1
+#define MOUSEKEY_WHEEL_TIME_TO_MAX 50
+
+#define NO_ACTION_FUNCTION
+#define NO_ACTION_MACRO
+
+#define PERMISSIVE_HOLD
+#define TAPPING_TERM 200
+#define TAPPING_TOGGLE 2
diff --git a/users/billypython/rules.mk b/users/billypython/rules.mk
new file mode 100644
index 0000000000..915323b499
--- /dev/null
+++ b/users/billypython/rules.mk
@@ -0,0 +1,6 @@
+SRC += billypython.c
+ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
+ SRC += tap_dance.c
+endif
+
+EXTRAFLAGS += -flto
diff --git a/users/billypython/tap_dance.c b/users/billypython/tap_dance.c
new file mode 100644
index 0000000000..74ae166393
--- /dev/null
+++ b/users/billypython/tap_dance.c
@@ -0,0 +1,33 @@
+#include "tap_dance.h"
+
+#define ACTION_TAP_DANCE_DOUBLE_MODS(mod1, mod2) { \
+ .fn = { td_double_mods_each, NULL, td_double_mods_reset }, \
+ .user_data = &(qk_tap_dance_pair_t){ mod1, mod2 }, \
+ }
+
+void td_double_mods_each(qk_tap_dance_state_t *state, void *user_data) {
+ qk_tap_dance_pair_t *mods = (qk_tap_dance_pair_t *)user_data;
+ // Single tap → mod1, double tap → mod2, triple tap etc. → mod1+mod2
+ if (state->count == 1 || state->count == 3) {
+ register_code(mods->kc1);
+ } else if (state->count == 2) {
+ unregister_code(mods->kc1);
+ register_code(mods->kc2);
+ }
+ // Prevent tap dance from sending kc1 and kc2 as weak mods
+ state->weak_mods &= ~(MOD_BIT(mods->kc1) | MOD_BIT(mods->kc2));
+}
+
+void td_double_mods_reset(qk_tap_dance_state_t *state, void *user_data) {
+ qk_tap_dance_pair_t *mods = (qk_tap_dance_pair_t *)user_data;
+ if (state->count == 1 || state->count >= 3) {
+ unregister_code(mods->kc1);
+ }
+ if (state->count >= 2) {
+ unregister_code(mods->kc2);
+ }
+}
+
+qk_tap_dance_action_t tap_dance_actions[] = {
+ [TD_RSF_RCT] = ACTION_TAP_DANCE_DOUBLE_MODS(KC_RSFT, KC_RCTL),
+};
diff --git a/users/billypython/tap_dance.h b/users/billypython/tap_dance.h
new file mode 100644
index 0000000000..2581981414
--- /dev/null
+++ b/users/billypython/tap_dance.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#include "quantum.h"
+
+#define RSF_RCT TD(TD_RSF_RCT)
+
+enum tap_dance {
+ TD_RSF_RCT,
+};