From f9fb52951de60e9428a6c397bf167a6e7e9433f3 Mon Sep 17 00:00:00 2001 From: James Young <18669334+noroadsleft@users.noreply.github.com> Date: Mon, 26 Apr 2021 23:44:45 -0700 Subject: Update noroadsleft userspace and keymaps (2021-04-26) (#12711) * Update noroadsleft userspace and keymaps (2021-04-26) - add Discipline keymap - move Emulated Non-US Backslash, Numeric Keypad and F13-F24 code fully to userspace - re-add some custom keycode handling I accidentally deleted - update VRSN keycode - update KC60 and userspace readmes * remove Git readme from kc60 keymap * update kc60:noroadsleft readme Concatenates this readme into one file, and updates the image links. --- users/noroadsleft/noroadsleft.c | 46 +++++++++++++++++++++++++++-- users/noroadsleft/noroadsleft.h | 2 +- users/noroadsleft/readme.md | 65 +++++++++++++++++++++++++++++++++-------- 3 files changed, 98 insertions(+), 15 deletions(-) (limited to 'users') diff --git a/users/noroadsleft/noroadsleft.c b/users/noroadsleft/noroadsleft.c index 6fb223f9ec..ac63427256 100644 --- a/users/noroadsleft/noroadsleft.c +++ b/users/noroadsleft/noroadsleft.c @@ -1,4 +1,4 @@ -/* Copyright 2020 James Young (@noroadsleft) +/* Copyright 2020-2021 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 @@ -32,7 +32,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case VRSN: if (record->event.pressed) { - SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION); } return false; case G_PUSH: @@ -118,6 +118,21 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { macroMode ^= 1; } return false; + case KC_Z: + if (record->event.pressed) { + if ( get_mods() & MOD_MASK_RALT ) { + register_code(KC_NUBS); + } else { + register_code(KC_Z); + } + } else { + if ( get_mods() & MOD_MASK_RALT ) { + unregister_code(KC_NUBS); + } else { + unregister_code(KC_Z); + } + }; + return false; case KC_1 ... KC_0: if (record->event.pressed) { if (get_mods() & MOD_MASK_RALT) { @@ -148,6 +163,33 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } return false; + case KC_PSCR: + if (record->event.pressed) { + if ( macroMode == 1 ) { + tap_code16(G(S(KC_3))); + } else { + tap_code(KC_PSCR); + } + } + return false; + case KC_HOME: + if (record->event.pressed) { + if ( macroMode == 1 ) { + tap_code16(G(KC_LEFT)); + } else { + tap_code(KC_HOME); + } + } + return false; + case KC_END: + if (record->event.pressed) { + if ( macroMode == 1 ) { + tap_code16(G(KC_RGHT)); + } else { + tap_code(KC_END); + } + } + return false; } // switch() return true; }; diff --git a/users/noroadsleft/noroadsleft.h b/users/noroadsleft/noroadsleft.h index 2d597219f5..52bcec0abd 100644 --- a/users/noroadsleft/noroadsleft.h +++ b/users/noroadsleft/noroadsleft.h @@ -1,4 +1,4 @@ -/* Copyright 2020 James Young (@noroadsleft) +/* Copyright 2020-2021 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 diff --git a/users/noroadsleft/readme.md b/users/noroadsleft/readme.md index f018a42271..6a454b7c74 100644 --- a/users/noroadsleft/readme.md +++ b/users/noroadsleft/readme.md @@ -2,29 +2,62 @@ 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` +- `kc60` +- `kbdfans/kbd75/rev1` +- `coseyfannitutti/discipline` -## Features -### Emulated Non-US Backslash +## Macro Features and Custom Keycodes -Sends `KC_NUBS` when the Z key is tapped while the Right Alt key is being held. +### [VRSN](./noroadsleft.c#L33-L37) -### Emulated Numeric Keypad +Outputs a string that tells me the Git commit from which my flashed firmware was built. Looks something like: -Turns number row keycodes into their numeric keypad equivalents while the Right Alt key is being held. + kc60:noroadsleft @ 0.6.326-6-gae6d7b-dirty -### Emulated F13-F24 +### Git Macros -Turns F1-F12 into F13-F24 while the Right Alt key is being held. +Some frequently used Git commands. + +| Keycode | Output | Output with Shift | +| :---------------------------------- | :--------------------- | :--------------------------- | +| [`G_PUSH`](./noroadsleft.c#L38-L42) | `git push origin ` | `git push origin ` | +| [`G_FTCH`](./noroadsleft.c#L43-L52) | `git fetch upstream ` | `git pull upstream ` | +| [`G_BRCH`](./noroadsleft.c#L53-L62) | `master` | `$(git branch-name)` | + +`$(git branch-name)` is an alias for `git rev-parse --abbrev-ref HEAD`, which normally return the name of the current branch. + +### "Macro Mode" Macros and Customized Keycodes + +Some of my macros and keycodes do different things depending on the value of the [`macroMode` variable](./noroadsleft.c#L23), which is [toggled between `0` and `1`](./noroadsleft.c#L116-L120) by the `M_MDSWP` custom keycode.[1](#footnotes) This is mainly at attempt to make various shortcuts use the same physical key combinations between Windows/Linux and MacOS (which I use at home and work, respectively). + +| Keycode | `macroMode == 0` | `macroMode == 1` | `macroMode == 1` with Shift | +| :------------------------------------- | :--------------- | :--------------- | :------------------------------------- | +| [`M_SALL`](./noroadsleft.c#L63-L71) | `Ctrl+A` | `Cmd+A` | `Cmd+A` | +| [`M_UNDO`](./noroadsleft.c#L72-L84) | `Ctrl+Z` | `Cmd+Z` | `Cmd+Shift+Z` | +| [`M_CUT`](./noroadsleft.c#L85-L93) | `Ctrl+X` | `Cmd+X` | `Cmd+X` | +| [`M_COPY`](./noroadsleft.c#L94-L102) | `Ctrl+C` | `Cmd+C` | `Cmd+C` | +| [`M_PASTE`](./noroadsleft.c#L103-L115) | `Ctrl+V` | `Cmd+V` | `Cmd+Shift+Opt+V` | +| [`KC_PSCR`](./noroadsleft.c#L166-L174) | `KC_PSCR` | `Cmd+Shift+3` | `Cmd+Shift+3` | +| [`KC_HOME`](./noroadsleft.c#L175-L183) | `KC_HOME` | `Cmd+Left` | `Cmd+Left` | +| [`KC_END`](./noroadsleft.c#L184-L192) | `KC_END` | `Cmd+Right` | `Cmd+Right` | + +### [Emulated Non-US Backslash](./noroadsleft.c#L121-L135) + +Sometimes I type in languages from countries that use ISO layout, but my keyboard is ANSI, so I have one key fewer. This macro simulates the Non-US Backslash key if I use Right Alt + `KC_Z`. + +### [Emulated Numeric Keypad](./noroadsleft.c#L136-L150) + +If I hold the Right Alt key, the number row (`KC_1` through `KC_0`) will output numpad keycodes instead of number row keycodes, enabling quicker access to characters like ™ and °. + +### [Emulated Extended Function Keys](./noroadsleft.c#L151-L165) + +Similar to the emulated numpad, if I hold the Right Alt key with the Fn key, the function row (`KC_F1` through `KC_F12`) will output keycodes `KC_F13` throught `KC_F24`. ## License -Copyright 2020 noroadsleft +Copyright 2020-2021 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 @@ -38,3 +71,11 @@ 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 . + + +## Footnotes + +- 1: [^](#macro-mode-macros-and-customized-keycodes) The `M_MDSWP` keycode is used in my keymaps in the following locations: + - [KC60](../../keyboards/kc60/keymaps/noroadsleft/keymap.c#L206) + - [KBDfans KBD75 rev1](../../keyboards/kbdfans/kbd75/keymaps/noroadsleft/keymap.c#L102) + - [CoseyFannitutti Discipline](../../keyboards/coseyfannitutti/discipline/keymaps/noroadsleft/keymap.c#L67) -- cgit v1.2.3