summaryrefslogtreecommitdiffstats
path: root/users
diff options
context:
space:
mode:
authorLuc <luc.wastiaux@xsmail.com>2022-12-12 13:21:23 +0800
committerGitHub <noreply@github.com>2022-12-11 21:21:23 -0800
commitbf2ed0174bb2c9e60555e41f682cae25b6e4dde7 (patch)
tree921b4dbc2d15fc21bb098adc9f51f750efc46de2 /users
parent96ba554ca8878a4bc434e68b1b265d6fb9b11365 (diff)
[Keymap] user dvorak_42_key ergodox_ez and crkbd keymaps (#19154)
Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: luc wastiaux <luc.wastiaux@airpost.net> Co-authored-by: Luc W <lucw@airpost.net>
Diffstat (limited to 'users')
-rw-r--r--users/dvorak_42_key/config.h8
-rw-r--r--users/dvorak_42_key/dvorak_42_key.c205
-rw-r--r--users/dvorak_42_key/dvorak_42_key.h161
-rw-r--r--users/dvorak_42_key/rules.mk7
-rw-r--r--users/dvorak_42_key/vscode_macros.h35
5 files changed, 416 insertions, 0 deletions
diff --git a/users/dvorak_42_key/config.h b/users/dvorak_42_key/config.h
new file mode 100644
index 0000000000..b6f9918770
--- /dev/null
+++ b/users/dvorak_42_key/config.h
@@ -0,0 +1,8 @@
+// Copyright 2022 LucW (@luc-languagetools)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#define DOUBLE_TAP_SHIFT_TURNS_ON_CAPS_WORD
+#undef TAPPING_TERM
+#define TAPPING_TERM 175 \ No newline at end of file
diff --git a/users/dvorak_42_key/dvorak_42_key.c b/users/dvorak_42_key/dvorak_42_key.c
new file mode 100644
index 0000000000..f4ec3cd06e
--- /dev/null
+++ b/users/dvorak_42_key/dvorak_42_key.c
@@ -0,0 +1,205 @@
+// Copyright 2022 LucW (@luc-languagetools)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "dvorak_42_key.h"
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+ // tap dance processing
+ qk_tap_dance_action_t *action;
+ switch (keycode) {
+ case TD(TD_DEL_WORD_DEL): // list all tap dance keycodes with tap-hold configurations
+ action = &tap_dance_actions[TD_INDEX(keycode)];
+ if (!record->event.pressed && action->state.count && !action->state.finished) {
+ tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)action->user_data;
+ tap_code16(tap_hold->tap);
+ }
+ }
+
+ // shell macros
+ if(record->event.pressed) {
+ switch (keycode) {
+ case SHELL_LS:
+ SEND_STRING("ls\n");
+ break;
+ case SHELL_LSLTR:
+ SEND_STRING("ls -ltr\n");
+ break;
+ case SHELL_LSLA:
+ SEND_STRING("ls -la\n");
+ break;
+ case SHELL_CDPRE:
+ SEND_STRING("cd ..\n");
+ break;
+ case SHELL_LESS:
+ SEND_STRING("less ");
+ break;
+ case SHELL_PLESS:
+ SEND_STRING(" | less");
+ break;
+ case SHELL_PGREP:
+ SEND_STRING(" | grep ");
+ return true;
+ break;
+ case SHELL_TAILF:
+ SEND_STRING("tail -f ");
+ break;
+ case SHELL_SCREENRD:
+ SEND_STRING("screen -r -d ");
+ break;
+ case SHELL_SCREEN_NEW:
+ SEND_STRING("screen -S ");
+ break;
+ case SHELL_SCREEN_LIST:
+ SEND_STRING("screen -list\n");
+ break;
+
+ case SHELL_GIT_DIFF:
+ SEND_STRING("git diff\n");
+ break;
+
+ case SHELL_GIT_STATUS:
+ SEND_STRING("git status\n");
+ break;
+
+ case WINDOWS10_WORKSPACE_LEFT:
+ tap_code16(C(G(KC_LEFT)));
+ break;
+ case WINDOWS10_WORKSPACE_RIGHT:
+ tap_code16(C(G(KC_RIGHT)));
+ break;
+ case WINDOWS10_TASK_VIEW:
+ tap_code16(G(KC_TAB));
+ break;
+ // linux screen shortcuts
+ case SCREEN_TAB_LEFT:
+ SEND_STRING(SS_LCTL("a") "p");
+ break;
+ case SCREEN_TAB_RIGHT:
+ SEND_STRING(SS_LCTL("a") "n");
+ break;
+ case SCREEN_NEW_TAB:
+ SEND_STRING(SS_LCTL("a") "c");
+ break;
+ case SCREEN_DETACH:
+ SEND_STRING(SS_LCTL("a") "d");
+ break;
+ case SCREEN_RENAME:
+ SEND_STRING(SS_LCTL("a") "A");
+ break;
+ case SCREEN_NUMBER:
+ SEND_STRING(SS_LCTL("a") ":number ");
+ break;
+ case SCREEN_0:
+ SEND_STRING(SS_LCTL("a") "0");
+ break;
+ case SCREEN_1:
+ SEND_STRING(SS_LCTL("a") "1");
+ break;
+ case SCREEN_2:
+ SEND_STRING(SS_LCTL("a") "2");
+ break;
+ case SCREEN_3:
+ SEND_STRING(SS_LCTL("a") "3");
+ break;
+ case SCREEN_4:
+ SEND_STRING(SS_LCTL("a") "4");
+ break;
+ case SCREEN_5:
+ SEND_STRING(SS_LCTL("a") "5");
+ break;
+ case SCREEN_6:
+ SEND_STRING(SS_LCTL("a") "6");
+ break;
+ case SCREEN_7:
+ SEND_STRING(SS_LCTL("a") "7");
+ break;
+ case SCREEN_8:
+ SEND_STRING(SS_LCTL("a") "8");
+ break;
+ case SCREEN_9:
+ SEND_STRING(SS_LCTL("a") "9");
+ break;
+ case SCREEN_COPY_MODE:
+ SEND_STRING(SS_LCTL("a") "[");
+ break;
+ case SCREEN_PASTE:
+ SEND_STRING(SS_LCTL("a") "]");
+ break;
+ case SCREEN_KILL:
+ SEND_STRING(SS_LCTL("a") "ky");
+ break;
+ case SCREEN_READREG_1:
+ SEND_STRING(SS_LCTL("a") ":readreg 1\n");
+ break;
+ case SCREEN_READREG_2:
+ SEND_STRING(SS_LCTL("a") ":readreg 2\n");
+ break;
+ case SCREEN_READREG_3:
+ SEND_STRING(SS_LCTL("a") ":readreg 3\n");
+ break;
+
+ case SCREEN_PASTEREG_1:
+ SEND_STRING(SS_LCTL("a") ":paste 1\n");
+ break;
+ case SCREEN_PASTEREG_2:
+ SEND_STRING(SS_LCTL("a") ":paste 2\n");
+ break;
+ case SCREEN_PASTEREG_3:
+ SEND_STRING(SS_LCTL("a") ":paste 3\n");
+ break;
+ }
+ }
+
+ return true;
+}
+
+
+bool caps_word_press_user(uint16_t keycode) {
+ switch (keycode) {
+ // Keycodes that continue Caps Word, with shift applied.
+ case KC_A ... KC_Z:
+ add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to next key.
+ return true;
+
+ default:
+ return false; // Deactivate Caps Word.
+ }
+}
+
+
+void tap_dance_tap_hold_finished(qk_tap_dance_state_t *state, void *user_data) {
+ tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)user_data;
+
+ if (state->pressed) {
+ if (state->count == 1
+#ifndef PERMISSIVE_HOLD
+ && !state->interrupted
+#endif
+ ) {
+ register_code16(tap_hold->hold);
+ tap_hold->held = tap_hold->hold;
+ } else {
+ register_code16(tap_hold->tap);
+ tap_hold->held = tap_hold->tap;
+ }
+ }
+}
+
+void tap_dance_tap_hold_reset(qk_tap_dance_state_t *state, void *user_data) {
+ tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)user_data;
+
+ if (tap_hold->held) {
+ unregister_code16(tap_hold->held);
+ tap_hold->held = 0;
+ }
+}
+
+
+// Tap Dance definitions
+qk_tap_dance_action_t tap_dance_actions[] = {
+ // Tap once for Escape, twice for Caps Lock
+ // [TD_BSPC_CTL_BSPC] = ACTION_TAP_DANCE_DOUBLE(KC_BSPC, RCTL(KC_BSPC)),
+ // [TD_BSPC_CTL_BSPC_IOS] = ACTION_TAP_DANCE_DOUBLE(KC_BSPC, LALT(KC_BSPC)),
+ [TD_DEL_WORD_DEL] = ACTION_TAP_DANCE_TAP_HOLD(RCTL(KC_BSPC), KC_BSPC),
+ [TD_DEL_WORD_DEL_IOS] = ACTION_TAP_DANCE_TAP_HOLD(LALT(KC_BSPC), KC_BSPC)
+}; \ No newline at end of file
diff --git a/users/dvorak_42_key/dvorak_42_key.h b/users/dvorak_42_key/dvorak_42_key.h
new file mode 100644
index 0000000000..4a3c34ba52
--- /dev/null
+++ b/users/dvorak_42_key/dvorak_42_key.h
@@ -0,0 +1,161 @@
+// Copyright 2022 LucW (@luc-languagetools)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include "quantum.h"
+
+// LAYERS
+// ======
+
+enum layer_names {
+ BASE, // base dvorak layer
+ KEYNAV, // arrow navigation (right hand)
+ KEYSEL, // arrow navigation + shift (allow text selection)
+ SHELL_NAV, // bash shortcuts
+ SHELL_SCREEN, // linux screen shortcuts
+ BROWSER_CONTROL, // control browser and mouse
+ COMBINED, // combined numbers and symbols layer
+ ANDROID_STUDIO, // android studio specific layer
+ VSCODE, // visual studio code specific layer
+ SHORTCUTS, // shortcuts to be intercepted by autohotkey
+};
+
+enum custom_keycodes {
+ PLACEHOLDER = SAFE_RANGE, // can always be here
+
+ // shell nav macros
+ SHELL_LS,
+ SHELL_LSLTR,
+ SHELL_LSLA,
+ SHELL_CDPRE,
+ SHELL_LESS,
+ SHELL_PLESS,
+ SHELL_PGREP,
+ SHELL_TAILF,
+
+ SHELL_SCREENRD,
+ SHELL_SCREEN_NEW,
+ SHELL_SCREEN_LIST,
+
+ SHELL_GIT_DIFF,
+ SHELL_GIT_STATUS,
+
+ // linux screen macros
+ SCREEN_TAB_LEFT,
+ SCREEN_TAB_RIGHT,
+
+ SCREEN_NEW_TAB,
+ SCREEN_DETACH,
+ SCREEN_RENAME,
+ SCREEN_NUMBER,
+ SCREEN_KILL,
+
+ SCREEN_0,
+ SCREEN_1,
+ SCREEN_2,
+ SCREEN_3,
+ SCREEN_4,
+ SCREEN_5,
+ SCREEN_6,
+ SCREEN_7,
+ SCREEN_8,
+ SCREEN_9,
+
+ SCREEN_COPY_MODE,
+ SCREEN_PASTE,
+
+ SCREEN_READREG_1,
+ SCREEN_READREG_2,
+ SCREEN_READREG_3,
+ SCREEN_PASTEREG_1,
+ SCREEN_PASTEREG_2,
+ SCREEN_PASTEREG_3,
+
+ // Windows 10 macros
+ WINDOWS10_WORKSPACE_LEFT,
+ WINDOWS10_WORKSPACE_RIGHT,
+ WINDOWS10_TASK_VIEW,
+
+};
+
+
+
+
+
+
+// Notepad++ shortcuts
+// ===================
+#define NP_DUPE_LINE LCTL(KC_D)
+
+// ChromeOS shortcuts
+// ==================
+#define CO_WS_LEFT RGUI(KC_LBRC)
+#define CO_WS_RIGHT RGUI(KC_RBRC)
+
+
+// Android Studio shortcuts
+#define AS_TABLEFT LALT(KC_LEFT)
+#define AS_TABRIGHT LALT(KC_RIGHT)
+#define AS_SYMBOL LCTL(LALT(KC_N))
+#define AS_CLASS LCTL(KC_N)
+#define AS_FINDUSAGE LALT(KC_F7)
+#define AS_BACK LCTL(LALT(KC_LEFT))
+#define AS_BRACKET LCTL(LSFT(KC_M))
+#define AS_GO_DECLARATION LCTL(KC_B)
+#define AS_GO_IMPLEMENTATION LCTL(LALT(KC_B))
+#define AS_CLOSETAB LCTL(KC_F4)
+#define AS_CLOSETOOLWINDOW LCTL(LSFT(KC_F4))
+#define AS_COPYLINEDOWN LCTL(KC_D)
+#define AS_DEL_LINE LCTL(KC_Y)
+#define AS_LINE LCTL(KC_G)
+#define AS_CMT_BLOCK LCTL(LSFT(KC_SLSH))
+#define AS_CMT_LINE LCTL(KC_SLSH)
+#define AS_BM_PREV LALT(KC_P)
+#define AS_BM_NEXT LALT(KC_N)
+#define AS_BM_TOGGLE KC_F11
+#define AS_BM_LIST LSFT(KC_F11)
+
+// visual studio code shortcuts
+// ============================
+
+#include "vscode_macros.h"
+
+// unused vscode shortcuts
+// #define VS_BM_LIST LCTL(LALT(KC_L))
+// #define VS_BM_LISTALL LCTL(LALT(KC_A))
+// #define VS_BM_CLEARALL LCTL(LALT(KC_C))
+
+// #define VS_TERMINAL_PREV MEH(KC_F12)
+// #define VS_TERMINAL_NEXT MEH(KC_F13)
+// #define VS_TERMINAL_NEW MEH(KC_F14)
+// #define VS_TERMINAL_DETACH MEH(KC_F15)
+// #define VS_TERMINAL_RENAME MEH(KC_F16)
+// #define VS_JUMPY MEH(KC_F17)
+// #define VS_FIND MEH(KC_F19)
+// #define VS_CLOSEPANEL LCTL(LSFT(KC_W))
+// #define VS_BUILD LCTL(LSFT(KC_B))
+// #define VS_OPEN_FILE MEH(KC_F2)
+// #define VS_TERMINAL MEH(KC_F15)
+
+
+
+
+// tap-dance configuration
+// =======================
+
+enum {
+ // TD_BSPC_CTL_BSPC,
+ // TD_BSPC_CTL_BSPC_IOS,
+ TD_DEL_WORD_DEL,
+ TD_DEL_WORD_DEL_IOS
+};
+
+typedef struct {
+ uint16_t tap;
+ uint16_t hold;
+ uint16_t held;
+} tap_dance_tap_hold_t;
+
+#define ACTION_TAP_DANCE_TAP_HOLD(tap, hold) \
+ { .fn = {NULL, tap_dance_tap_hold_finished, tap_dance_tap_hold_reset}, .user_data = (void *)&((tap_dance_tap_hold_t){tap, hold, 0}), }
diff --git a/users/dvorak_42_key/rules.mk b/users/dvorak_42_key/rules.mk
new file mode 100644
index 0000000000..f1ba426225
--- /dev/null
+++ b/users/dvorak_42_key/rules.mk
@@ -0,0 +1,7 @@
+# Copyright 2022 LucW (@luc-languagetools)
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+CAPS_WORD_ENABLE = yes
+TAP_DANCE_ENABLE = yes
+
+SRC += dvorak_42_key.c \ No newline at end of file
diff --git a/users/dvorak_42_key/vscode_macros.h b/users/dvorak_42_key/vscode_macros.h
new file mode 100644
index 0000000000..529f148d06
--- /dev/null
+++ b/users/dvorak_42_key/vscode_macros.h
@@ -0,0 +1,35 @@
+// Copyright 2022 LucW (@luc-languagetools)
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+#define VS_COMMANDS MEH(KC_B) // workbench.action.showCommands
+#define VS_LINE MEH(KC_C) // workbench.action.gotoLine
+#define VS_DEFINITION MEH(KC_E) // editor.action.revealDefinition
+#define VS_IMPLEMENTATION MEH(KC_F) // editor.action.goToImplementation
+#define VS_REFERENCES MEH(KC_G) // editor.action.goToReferences
+#define VS_BACK MEH(KC_H) // workbench.action.navigateBack
+#define VS_BRACKET MEH(KC_I) // editor.action.jumpToBracket
+#define VS_TABLEFT MEH(KC_J) // workbench.action.previousEditor
+#define VS_TABRIGHT MEH(KC_K) // workbench.action.nextEditor
+#define VS_CLOSETAB MEH(KC_L) // workbench.action.closeActiveEditor
+#define VS_GROUP_1 MEH(KC_M) // workbench.action.focusFirstEditorGroup
+#define VS_GROUP_2 MEH(KC_N) // workbench.action.focusSecondEditorGroup
+#define VS_CMT_BLOCK MEH(KC_O) // editor.action.blockComment
+#define VS_CMT_LINE MEH(KC_P) // editor.action.commentLine
+#define VS_DEL_LINE MEH(KC_Q) // editor.action.deleteLines
+#define VS_COPYLINEDOWN MEH(KC_R) // editor.action.copyLinesDownAction
+#define VS_BM_PREV MEH(KC_S) // bookmarks.jumpToPrevious
+#define VS_BM_NEXT MEH(KC_T) // bookmarks.jumpToNext
+#define VS_BM_TOGGLE MEH(KC_U) // bookmarks.toggle
+#define VS_BM_CLEARALL MEH(KC_V) // bookmarks.clearFromAllFiles
+#define VS_BM_LIST MEH(KC_W) // bookmarks.list
+#define VS_BM_LISTALL MEH(KC_X) // bookmarks.listFromAllFiles
+#define VS_JUMPY MEH(KC_Y) // extension.jumpy-word
+#define VS_FOCUS_EDITOR MEH(KC_Z) // workbench.action.focusActiveEditorGroup
+#define VS_FOCUS_TERMINAL MEH(KC_0) // workbench.action.terminal.focus
+#define VS_TOGGLE_TERMINAL MEH(KC_1) // workbench.action.terminal.toggleTerminal
+#define VS_DEL_LEFT MEH(KC_2) // deleteAllLeft
+#define VS_DEL_RIGHT MEH(KC_3) // deleteAllRight
+#define VS_FIND_FILES MEH(KC_4) // workbench.action.findInFiles
+#define VS_FILE MEH(KC_5) // workbench.action.quickOpen
+#define VS_SYMBOLEDITOR MEH(KC_6) // workbench.action.gotoSymbol