From 5a73558a211383cd238587369ef043a6d5b64b88 Mon Sep 17 00:00:00 2001
From: James Young <18669334+noroadsleft@users.noreply.github.com>
Date: Wed, 10 Feb 2021 11:17:42 -0800
Subject: [Keymap] add noroadsleft userspace; add and update keymaps (#11686)
---
users/noroadsleft/noroadsleft.c | 153 ++++++++++++++++++++++++++++++++++++++++
users/noroadsleft/noroadsleft.h | 38 ++++++++++
users/noroadsleft/readme.md | 40 +++++++++++
users/noroadsleft/rules.mk | 1 +
4 files changed, 232 insertions(+)
create mode 100644 users/noroadsleft/noroadsleft.c
create mode 100644 users/noroadsleft/noroadsleft.h
create mode 100644 users/noroadsleft/readme.md
create mode 100644 users/noroadsleft/rules.mk
(limited to 'users')
diff --git a/users/noroadsleft/noroadsleft.c b/users/noroadsleft/noroadsleft.c
new file mode 100644
index 0000000000..6fb223f9ec
--- /dev/null
+++ b/users/noroadsleft/noroadsleft.c
@@ -0,0 +1,153 @@
+/* Copyright 2020 James Young (@noroadsleft)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "noroadsleft.h"
+#include "version.h"
+
+/*******************
+** MODIFIER MASKS **
+*******************/
+bool macroMode = 0;
+
+__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 VRSN:
+ if (record->event.pressed) {
+ SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
+ }
+ return false;
+ case G_PUSH:
+ if (record->event.pressed) {
+ SEND_STRING("git push origin ");
+ };
+ return false;
+ case G_FTCH:
+ if (record->event.pressed) {
+ if ( get_mods() & MOD_MASK_SHIFT ) {
+ clear_mods();
+ SEND_STRING("git pull upstream ");
+ } else {
+ SEND_STRING("git fetch upstream ");
+ }
+ };
+ return false;
+ case G_BRCH:
+ if (record->event.pressed) {
+ if ( get_mods() & MOD_MASK_SHIFT ) {
+ clear_mods();
+ SEND_STRING("master");
+ } else {
+ SEND_STRING("$(git branch-name)");
+ }
+ };
+ return false;
+ case M_SALL:
+ if (record->event.pressed) {
+ if ( macroMode == 1 ) {
+ SEND_STRING(SS_LGUI("a"));
+ } else {
+ SEND_STRING(SS_LCTL("a"));
+ }
+ }
+ return false;
+ case M_UNDO:
+ if (record->event.pressed) {
+ if ( macroMode == 1 ) {
+ if ( get_mods() & MOD_MASK_SHIFT ) {
+ SEND_STRING(SS_LSFT(SS_LGUI("z")));
+ } else {
+ SEND_STRING(SS_LGUI("z"));
+ }
+ } else {
+ SEND_STRING(SS_LCTL("z"));
+ }
+ }
+ return false;
+ case M_CUT:
+ if (record->event.pressed) {
+ if ( macroMode == 1 ) {
+ SEND_STRING(SS_LGUI("x"));
+ } else {
+ SEND_STRING(SS_LCTL("x"));
+ }
+ }
+ return false;
+ case M_COPY:
+ if (record->event.pressed) {
+ if ( macroMode == 1 ) {
+ SEND_STRING(SS_LGUI("c"));
+ } else {
+ SEND_STRING(SS_LCTL("c"));
+ }
+ }
+ return false;
+ case M_PASTE:
+ if (record->event.pressed) {
+ if ( macroMode == 1 ) {
+ if ( get_mods() & MOD_MASK_SHIFT ) {
+ SEND_STRING(SS_LSFT(SS_LALT(SS_LGUI("v"))));
+ } else {
+ SEND_STRING(SS_LGUI("v"));
+ }
+ } else {
+ SEND_STRING(SS_LCTL("v"));
+ }
+ }
+ return false;
+ case M_MDSWP:
+ if (record->event.pressed) {
+ macroMode ^= 1;
+ }
+ return false;
+ case KC_1 ... KC_0:
+ if (record->event.pressed) {
+ if (get_mods() & MOD_MASK_RALT) {
+ register_code(keycode + 0x3B);
+ } else {
+ register_code(keycode);
+ }
+ } else {
+ if (get_mods() & MOD_MASK_RALT) {
+ unregister_code(keycode + 0x3B);
+ } else {
+ unregister_code(keycode);
+ }
+ }
+ return false;
+ case KC_F1 ... KC_F12:
+ if (record->event.pressed) {
+ if (get_mods() & MOD_MASK_RALT) {
+ register_code(keycode + 0x2E);
+ } else {
+ register_code(keycode);
+ }
+ } else {
+ if (get_mods() & MOD_MASK_RALT) {
+ unregister_code(keycode + 0x2E);
+ } else {
+ unregister_code(keycode);
+ }
+ }
+ return false;
+ } // switch()
+ return true;
+};
diff --git a/users/noroadsleft/noroadsleft.h b/users/noroadsleft/noroadsleft.h
new file mode 100644
index 0000000000..2d597219f5
--- /dev/null
+++ b/users/noroadsleft/noroadsleft.h
@@ -0,0 +1,38 @@
+/* Copyright 2020 James Young (@noroadsleft)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#pragma once
+
+#include QMK_KEYBOARD_H
+
+#define MOD_MASK_RALT (MOD_BIT(KC_RALT))
+extern bool macroMode;
+
+enum userspace_keycodes {
+ VRSN = SAFE_RANGE,
+ G_PUSH,
+ G_FTCH,
+ G_BRCH,
+ M_SALL,
+ M_UNDO,
+ M_CUT,
+ M_COPY,
+ M_PASTE,
+ M_MDSWP,
+ KEYMAP_SAFE_RANGE
+};
+
+bool process_record_keymap(uint16_t keycode, keyrecord_t *record);
diff --git a/users/noroadsleft/readme.md b/users/noroadsleft/readme.md
new file mode 100644
index 0000000000..f018a42271
--- /dev/null
+++ b/users/noroadsleft/readme.md
@@ -0,0 +1,40 @@
+# @noroadsleft's Userspace
+
+This directory holds the code that's the same for every keyboard I use in QMK, which is currently:
+
+| Status | Keyboard |
+| :----------------- | :------- |
+| :heavy_check_mark: | `kc60`
+| :heavy_check_mark: | `kbdfans/kbd75/rev1`
+
+## Features
+
+### Emulated Non-US Backslash
+
+Sends `KC_NUBS` when the Z key is tapped while the Right Alt key is being held.
+
+### Emulated Numeric Keypad
+
+Turns number row keycodes into their numeric keypad equivalents while the Right Alt key is being held.
+
+### Emulated F13-F24
+
+Turns F1-F12 into F13-F24 while the Right Alt key is being held.
+
+
+## License
+
+Copyright 2020 noroadsleft
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
diff --git a/users/noroadsleft/rules.mk b/users/noroadsleft/rules.mk
new file mode 100644
index 0000000000..2ae1988142
--- /dev/null
+++ b/users/noroadsleft/rules.mk
@@ -0,0 +1 @@
+SRC += noroadsleft.c
\ No newline at end of file
--
cgit v1.2.3