From fd0bd29a0a3f2de93a3e561007805fac67e7e0cd Mon Sep 17 00:00:00 2001 From: ishtob Date: Fri, 10 Aug 2018 11:30:21 -0400 Subject: Keymap: adding my personal userspace to QMK master (#3605) * Adding my personal planck keymap * Adding readme.md to my keymap * Create my userspace add users/ishtob/ * Moved macros off keymap macros now exsists in my userspace, moved them off keyboard specific keymaps * Create my userspace add users/ishtob/ * rebase from main QMK repo --- users/ishtob/config.h | 76 +++++++++++++++++++++++++++++++++++++++++++ users/ishtob/ishtob.c | 69 +++++++++++++++++++++++++++++++++++++++ users/ishtob/ishtob.h | 76 +++++++++++++++++++++++++++++++++++++++++++ users/ishtob/readme.md | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++ users/ishtob/rules.mk | 7 ++++ 5 files changed, 315 insertions(+) create mode 100755 users/ishtob/config.h create mode 100644 users/ishtob/ishtob.c create mode 100644 users/ishtob/ishtob.h create mode 100644 users/ishtob/readme.md create mode 100755 users/ishtob/rules.mk (limited to 'users/ishtob') diff --git a/users/ishtob/config.h b/users/ishtob/config.h new file mode 100755 index 0000000000..9c4a7ed8dd --- /dev/null +++ b/users/ishtob/config.h @@ -0,0 +1,76 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "config_common.h" + +#ifdef AUDIO_ENABLE + #define STARTUP_SONG SONG(PLANCK_SOUND) + // #define STARTUP_SONG SONG(NO_SOUND) + + #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ + SONG(COLEMAK_SOUND), \ + SONG(DVORAK_SOUND) \ + } +#endif + +//#define LEADER_TIMEOUT 300 +//#define BACKLIGHT_BREATHING +#define PREVENT_STUCK_MODIFIERS +//#define PERMISSIVE_HOLD +// #define QMK_KEYS_PER_SCAN 4 + +//audio clicky + //#define AUDIO_CLICKY + // to enable clicky on startup + //#define AUDIO_CLICKY_ON + //#define AUDIO_CLICKY_FREQ_RANDOMNESS 1.0f + +/* ws2812 RGB LED +#define RGB_DI_PIN B5 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 8 // Number of LEDs +#define RGBLIGHT_HUE_STEP 10 +#define RGBLIGHT_SAT_STEP 17 +*/ +#undef PLANCK_MIT_LAYOUT + +//#define MUON_LEFT + +#undef DEBOUNCE +#define DEBOUNCE 0 + +//rgb-reactive +//#define RGB_MATRIX_KEYPRESSES +//#define EECONFIG_RGB_MATRIX (uint32_t *)16 + +//skip usb startup check +//#define NO_USB_STARTUP_CHECK + + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 + +// Most tactile encoders have detents every 4 stages +#define ENCODER_RESOLUTION 4 + +#endif diff --git a/users/ishtob/ishtob.c b/users/ishtob/ishtob.c new file mode 100644 index 0000000000..1b847d6306 --- /dev/null +++ b/users/ishtob/ishtob.c @@ -0,0 +1,69 @@ +/* +Based on userspace written by @drashna 2017 +Copyright 2018 Hsian Chang @ishtob + +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 "ishtob.h" +#include "action.h" +#include "action_layer.h" +// #include "dynamic_macro.h" +#ifdef AUDIO_ENABLE + #include "audio.h" +#endif + + +// Add reconfigurable functions here, for keymap customization +// This allows for a global, userspace functions, and continued +// customization of the keymap. Use _keymap instead of _user +// functions in the keymaps +__attribute__ ((weak)) +void matrix_init_keymap(void) {} + +__attribute__ ((weak)) +void matrix_scan_keymap(void) {} + +__attribute__ ((weak)) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; +} + +__attribute__ ((weak)) +bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { + return true; +} + +// Call user matrix init, then call the keymap's init function +void matrix_init_user(void) { + matrix_init_keymap(); +} + +// No global matrix scan code, so just run keymap's matix +// scan function +void matrix_scan_user(void) { + matrix_scan_keymap(); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case DFU: + if (record->event.pressed) { + clear_keyboard(); + reset_keyboard(); + } + return false; + break; + } + return process_record_keymap(keycode, record) && process_record_secrets(keycode, record); +} + diff --git a/users/ishtob/ishtob.h b/users/ishtob/ishtob.h new file mode 100644 index 0000000000..2c47fce791 --- /dev/null +++ b/users/ishtob/ishtob.h @@ -0,0 +1,76 @@ +#ifndef USERSPACE +#define USERSPACE +#include "quantum.h" + +enum userspace_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + PLOVER, + LOWER, + RAISE, + BACKLIT, + EXT_PLV, + DFU, + P_CITRIX, //these macro exsists in macros_private.c, which is excluded from git + P_MPASS, + P_META, + O_DAYRN, + O_RTQ6H, + O_3DRN, + O_AUTODC, + M_EMAIL, + M_EMAIL2 +}; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _PLOVER 5 +#define _FNLAYER 6 +#define _NUMLAY 7 +#define _MOUSECURSOR 8 +#define _ADJUST 16 + + + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO +// Custom macros +#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl +#define CTL_TTAB CTL_T(KC_TAB) // Tap for Esc, hold for Ctrl +#define CTL_ENT CTL_T(KC_ENT) // Tap for Enter, hold for Ctrl +#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift +// Requires KC_TRNS/_______ for the trigger key in the destination layer +#define LT_FN(kc) LT(_FNLAYER, kc) // L-ayer T-ap Function Layer +#define LT_MC(kc) LT(_MOUSECURSOR, kc) // L-ayer T-ap M-ouse C-ursor +#define LT_RAI(kc) LT(_RAISE, kc) // L-ayer T-ap to Raise +#define TG_NUMLAY TG(_NUMLAY) //Toggle for layer _NUMLAY +/* +enum userspace_layers { + _QWERTY = 0, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _PLOVER, + _FNLAYER, + _NUMLAY, + _MOUSECURSOR, + _ADJUST +}; +*/ + + + +#endif // !USERSPACE \ No newline at end of file diff --git a/users/ishtob/readme.md b/users/ishtob/readme.md new file mode 100644 index 0000000000..5b7064de9e --- /dev/null +++ b/users/ishtob/readme.md @@ -0,0 +1,87 @@ +# Ishtob's userspace + +under developement + +# Secret Macros + +This section is a modified version of what @drashna did in his userspace: https://github.com/qmk/qmk_firmware/tree/master/users/drashna#secret-macros + +`macros_private.c` will be used if it exsists in the userspace folder during compiling. + +To get started, put the following in rules.mk. this will have the compiler include the macros_private.c file if it exsists. +``` +SRC += ishtob.c +ifneq ($(wildcard $(USER_PATH)/macros_private.c),"") + SRC += macros_private.c +endif +ifeq ($(strip $(NO_SECRETS)), yes) + OPT_DEFS += -DNO_SECRETS +endif +``` + +Remember that all macro keycode has to be present in the header file (ishtob.h) to prevent error during compile. + +Next, you setup macros_private.c, ensure the keycodes are defined in ishtob.h (or your keymap.h). +Here is an example of my macros with the sensitive login information removed: +``` +#include "ishtob.h" //replace this with your userspace or keymap +#include "quantum.h" + +#pragma message "secret macros included" //debug line to let me know this file is included in the compile + +//this str is for the monthly password rotation per my workplace's security policy +char my_str[5] = "stuff"; + +bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { + if (record->event.pressed) { + switch(keycode) { + //my login macros + case P_CITRIX: + SEND_STRING("username"SS_TAP(X_TAB)"something"); + send_string(my_str); + return false; + case P_MPASS: + SEND_STRING("something"); + send_string(my_str); + return false; + case P_META: + SEND_STRING("metausername"); + return false; + //my work macros for the meta application + case O_RTQ6H: + SEND_STRING(SS_TAP(X_TAB)"0300"SS_TAP(X_TAB)SS_TAP(X_DOWN)SS_TAP(X_TAB)"0900"SS_TAP(X_TAB)SS_TAP(X_DOWN)SS_TAP(X_TAB)"1500"SS_TAP(X_TAB)SS_TAP(X_DOWN)SS_TAP(X_TAB)"2100"SS_TAP(X_TAB)SS_LALT("o")); + return false; + case O_AUTODC: + SEND_STRING(SS_LALT("v")SS_TAP(X_TAB)SS_TAP(X_TAB)SS_TAP(X_TAB)SS_TAP(X_TAB)SS_TAP(X_TAB)SS_TAP(X_TAB)SS_TAP(X_TAB)SS_TAP(X_TAB)SS_TAP(X_TAB)"T"SS_TAP(X_TAB)"N"SS_LALT("s")); + return false; + case O_DAYRN: + SEND_STRING(SS_TAP(X_TAB)SS_TAP(X_TAB)SS_TAP(X_TAB)SS_TAP(X_TAB)SS_TAP(X_TAB)"1"SS_LALT("s")); + return false; + //Ops macros + case M_EMAIL: + SEND_STRING("privatemail@email.com"); + return false; + case M_EMAIL2: + SEND_STRING("workemail@work.com"); + return false; + } + } + return true; +} +``` + + +Finally, add the following to .git/info/exclude to prevent private macros from being committed to git. +``` +# git ls-files --others --exclude-from=.git/info/exclude +# Lines that start with '#' are comments. +# For a project mostly in C, the following would be a good set of +# exclude patterns (uncomment them if you want to use them): +# *.[oa] +# *~ +/users/ishtob/macros_private.c +``` + +# Special mentions + +special thanks to @drashna for helping me through quite a bit of these codes. \ No newline at end of file diff --git a/users/ishtob/rules.mk b/users/ishtob/rules.mk new file mode 100755 index 0000000000..d19e952667 --- /dev/null +++ b/users/ishtob/rules.mk @@ -0,0 +1,7 @@ +SRC += ishtob.c +ifneq ($(wildcard $(USER_PATH)/macros_private.c),"") + SRC += macros_private.c +endif +ifeq ($(strip $(NO_SECRETS)), yes) + OPT_DEFS += -DNO_SECRETS +endif -- cgit v1.2.3