summaryrefslogtreecommitdiff
path: root/users/zyber
diff options
context:
space:
mode:
authorZyberSE <reine@tuba.nu>2022-09-30 04:01:33 +0200
committerGitHub <noreply@github.com>2022-09-29 19:01:33 -0700
commitadcdacf93c7d83306e794fad8f6c3c1ba19bd414 (patch)
treeb7bf2eb4bafe8d8260c80c62eea92ad1c1857ab7 /users/zyber
parent5b2eb4ec85062125ed44c1a790d087a1d604a1ed (diff)
[Keymap] Personal user space code and keymaps by ZyBeR (#18512)
Co-authored-by: ZyBeR <n/a>
Diffstat (limited to 'users/zyber')
-rw-r--r--users/zyber/config.h9
-rw-r--r--users/zyber/rules.mk8
-rw-r--r--users/zyber/zyber.c137
-rw-r--r--users/zyber/zyber.h33
4 files changed, 187 insertions, 0 deletions
diff --git a/users/zyber/config.h b/users/zyber/config.h
new file mode 100644
index 0000000000..be005d8008
--- /dev/null
+++ b/users/zyber/config.h
@@ -0,0 +1,9 @@
+// Copyright 2022 ZyBeR (@ZyberSE)
+// SPDX-License-Identifier: GPL-2.0
+
+#pragma once
+
+#undef TAPPING_TERM
+#define TAPPING_TERM 152
+#define GRAVE_ESC_GUI_OVERRIDE
+#define BOTH_SHIFTS_TURNS_ON_CAPS_WORD
diff --git a/users/zyber/rules.mk b/users/zyber/rules.mk
new file mode 100644
index 0000000000..83559df609
--- /dev/null
+++ b/users/zyber/rules.mk
@@ -0,0 +1,8 @@
+SRC += zyber.c
+
+CAPS_WORD_ENABLE = yes
+TAP_DANCE_ENABLE = yes
+COMMAND_ENABLE = no
+
+# DISABLE VIA CONFIGURATOR (otherwise QMK won't work properly)
+DYNAMIC_KEYMAP_ENABLE = no
diff --git a/users/zyber/zyber.c b/users/zyber/zyber.c
new file mode 100644
index 0000000000..63915ddbd4
--- /dev/null
+++ b/users/zyber/zyber.c
@@ -0,0 +1,137 @@
+// Copyright 2022 ZyBeR (@ZyberSE)
+// SPDX-License-Identifier: GPL-2.0
+
+#include "zyber.h"
+
+
+__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; }
+
+uint16_t key_timer;
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ if (record->event.pressed) {
+ key_timer = timer_read();
+ }
+
+ if (!process_caps_word(keycode, record)) {
+ return false;
+ }
+
+ switch(keycode) {
+ case C_BLK:
+ if (record->event.pressed) {
+ send_string("```" SS_DELAY(80) SS_LCMD("v") SS_DELAY(80) "```");
+ }
+ break;
+
+ case CTRL_C_UP:
+ if (record->event.pressed) {
+ register_mods(MOD_BIT(KC_LEFT_CTRL));
+ } else {
+ unregister_mods(MOD_BIT(KC_LEFT_CTRL));
+ if (timer_elapsed(key_timer) < TAPPING_TERM) {
+ tap_code16(C(KC_UP));
+ }
+ }
+ return false;
+ break;
+
+ case L1_EXPL:
+ if (record->event.pressed) {
+ layer_on(1);
+ } else {
+ layer_off(1);
+ if (timer_elapsed(key_timer) < TAPPING_TERM) {
+ tap_code16(C(KC_UP));
+ }
+ }
+ return false;
+ break;
+
+ case ROPT_SRH:
+ if (record->event.pressed) {
+ register_mods(MOD_BIT(KC_ROPT));
+ } else {
+ unregister_mods(MOD_BIT(KC_ROPT));
+ if (timer_elapsed(key_timer) < TAPPING_TERM) {
+ tap_code16(G(KC_SPC));
+ }
+ }
+ return false;
+ break;
+ }
+
+ return process_record_keymap(keycode, record);
+}
+
+/* Screenshoot */
+void dance_SSHT_finished(qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 2) {
+ tap_code16(C(S(G(KC_4))));
+ } else {
+ tap_code(KC_4);
+ }
+}
+void dance_SSHT_reset(qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 2) {
+ unregister_code16(C(S(G(KC_4))));
+ } else {
+ unregister_code(KC_4);
+ }
+}
+
+/* Å */
+void dance_LBRC_finished(qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 2) {
+ tap_code16(A(KC_LBRC));
+ } else {
+ tap_code(KC_LBRC);
+ }
+}
+void dance_LBRC_reset(qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 2) {
+ unregister_code16(A(KC_LBRC));
+ } else {
+ unregister_code(KC_LBRC);
+ }
+}
+
+/* Ö */
+void dance_SCLN_finished(qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 2) {
+ tap_code16(A(KC_SCLN));
+ } else {
+ tap_code(KC_SCLN);
+ }
+}
+void dance_SCLN_reset(qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 2) {
+ unregister_code16(A(KC_SCLN));
+ } else {
+ unregister_code(KC_SCLN);
+ }
+}
+
+/* Ä */
+void dance_QUOT_finished(qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 2) {
+ tap_code16(A(KC_QUOT));
+ } else {
+ tap_code(KC_QUOT);
+ }
+}
+void dance_QUOT_reset(qk_tap_dance_state_t *state, void *user_data) {
+ if (state->count == 2) {
+ unregister_code16(A(KC_QUOT));
+ } else {
+ unregister_code(KC_QUOT);
+ }
+}
+
+qk_tap_dance_action_t tap_dance_actions[] = {
+ [SSHT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_SSHT_finished, dance_SSHT_reset),
+ [LBRC] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_LBRC_finished, dance_LBRC_reset),
+ [SCLN] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_SCLN_finished, dance_SCLN_reset),
+ [QUOT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_QUOT_finished, dance_QUOT_reset),
+ [END_HOME] = ACTION_TAP_DANCE_DOUBLE(LGUI(KC_LEFT), LGUI(KC_RIGHT))
+};
diff --git a/users/zyber/zyber.h b/users/zyber/zyber.h
new file mode 100644
index 0000000000..d5f114e852
--- /dev/null
+++ b/users/zyber/zyber.h
@@ -0,0 +1,33 @@
+// Copyright 2022 ZyBeR (@ZyberSE)
+// SPDX-License-Identifier: GPL-2.0
+
+#pragma once
+
+#include QMK_KEYBOARD_H
+#include "quantum.h"
+
+enum custom_keycodes {
+ CTRL_C_UP = SAFE_RANGE,
+ L1_EXPL,
+ ROPT_SRH,
+ C_BLK
+};
+
+enum tap_dances {
+ SSHT = 0,
+ LBRC,
+ SCLN,
+ QUOT,
+ END_HOME
+};
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record);
+
+void dance_SSHT_finished(qk_tap_dance_state_t *state, void *user_data);
+void dance_SSHT_reset(qk_tap_dance_state_t *state, void *user_data);
+void dance_LBRC_finished(qk_tap_dance_state_t *state, void *user_data);
+void dance_LBRC_reset(qk_tap_dance_state_t *state, void *user_data);
+void dance_SCLN_finished(qk_tap_dance_state_t *state, void *user_data);
+void dance_SCLN_reset(qk_tap_dance_state_t *state, void *user_data);
+void dance_QUOT_finished(qk_tap_dance_state_t *state, void *user_data);
+void dance_QUOT_reset(qk_tap_dance_state_t *state, void *user_data);