diff options
author | Matthew Lyon <matthew@lyonheart.us> | 2019-07-08 06:27:30 -0700 |
---|---|---|
committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-07-08 06:27:30 -0700 |
commit | 06ba968759041d8c6dfe1309888d21bdbc16cd24 (patch) | |
tree | de550b10caa37eeb344bbb65e957e10f63cd419a /users | |
parent | 75795186135e6d83de1ff3bb108f9c5471742ba4 (diff) |
mattly's userspace and iris (#6279)
Diffstat (limited to 'users')
-rw-r--r-- | users/mattly/config.h | 9 | ||||
-rw-r--r-- | users/mattly/mattly.c | 70 | ||||
-rw-r--r-- | users/mattly/mattly.h | 83 | ||||
-rw-r--r-- | users/mattly/readme.md | 10 | ||||
-rw-r--r-- | users/mattly/rules.mk | 2 |
5 files changed, 174 insertions, 0 deletions
diff --git a/users/mattly/config.h b/users/mattly/config.h new file mode 100644 index 0000000000..25d3798011 --- /dev/null +++ b/users/mattly/config.h @@ -0,0 +1,9 @@ +#pragma once + +// Most tactile encoders have detents every 4 stages +#define ENCODER_RESOLUTION 4 + +#define IGNORE_MOD_TAP_INTERRUPT +#define PERMISSIVE_HOLD +#define TAPPING_TOGGLE 2 +#define TAPPING_TERM 200 diff --git a/users/mattly/mattly.c b/users/mattly/mattly.c new file mode 100644 index 0000000000..1e61e01265 --- /dev/null +++ b/users/mattly/mattly.c @@ -0,0 +1,70 @@ +#include "mattly.h" + +__attribute__ ((weak)) +layer_state_t layer_state_set_keymap (layer_state_t state) { + return state; +} + +void set_lights_default(void) { + #ifdef RGBLIGHT_ENABLE + if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { + rgblight_sethsv_noeeprom(HSV_CAPS); + } else { + rgblight_sethsv_noeeprom(HSV_DEFAULT); + } + #endif +} + +void layer_state_set_rgb(layer_state_t state) { +#ifdef RGBLIGHT_ENABLE + switch (biton32(state)) { + case _QWERTY: + set_lights_default(); + break; + case _SYMBOL: + rgblight_sethsv_noeeprom(HSV_SYMBOL); + break; + case _NAVNUM: + rgblight_sethsv_noeeprom(HSV_NAVNUM); + break; + case _FUNCT: + rgblight_sethsv_noeeprom(HSV_FUNCT); + break; + } +#endif +} + + +layer_state_t layer_state_set_user (layer_state_t state) { + state = update_tri_layer_state(state, _SYMBOL, _NAVNUM, _FUNCT); + layer_state_set_rgb(state); + return layer_state_set_keymap (state); +} + +void on_reset(void) { + #ifdef RGBLIGHT_ENABLE + rgblight_sethsv_noeeprom(HSV_RESET); + #endif +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case KC_CAPS: + #ifdef RGBLIGHT_ENABLE + set_lights_default(); + #endif + return true; + case RESET: + on_reset(); + return true; + default: + return true; + } +} + +void keyboard_post_init_user(void) { +#ifdef RGBLIGHT_ENABLE + rgblight_enable_noeeprom(); + set_lights_default(); +#endif +} diff --git a/users/mattly/mattly.h b/users/mattly/mattly.h new file mode 100644 index 0000000000..08318840d0 --- /dev/null +++ b/users/mattly/mattly.h @@ -0,0 +1,83 @@ +/* Copyright 2019 Matthew Lyon + * + * 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 <http://www.gnu.org/licenses/>. + */ + +#ifndef USERSPACE +#define USERSPACE + +#include "quantum.h" + +enum { + _QWERTY, + _NAVNUM, + _SYMBOL, + _FUNCT, +}; + +// left hand +#define ESC_HYP MT(MOD_HYPR, KC_ESC) +#define BSP_NUM LT(_NAVNUM, KC_BSPC) +#define ENT_SFT MT(MOD_LSFT, KC_ENT) +#define SPC_SFT MT(MOD_LSFT, KC_SPC) + +// right hand +#define SPC_SFT MT(MOD_LSFT, KC_SPC) +#define TAB_SYM LT(_SYMBOL, KC_TAB) +#define DEL_WRP MT(MOD_LCTL | MOD_LALT | MOD_LGUI, KC_DEL) + +#define NAVLOCK TG(_NAVNUM) +#define SYMLOCK TG(_SYMBOL) + + +// QWERTY + +#define A_CTRL MT(MOD_LCTL, KC_A) +#define S_ALT MT(MOD_LALT, KC_S) +#define D_GUI MT(MOD_LGUI, KC_D) +#define F_SHFT MT(MOD_LSFT, KC_F) +#define J_SHFT MT(MOD_RSFT, KC_J) +#define K_GUI MT(MOD_RGUI, KC_K) +#define L_ALT MT(MOD_RALT, KC_L) +#define MINSCTL MT(MOD_RCTL, KC_MINS) + +#define BWORD LALT(KC_LEFT) +#define FWORD LALT(KC_RIGHT) + +// OS X default keys +#define NWIN LGUI(KC_GRV) // Next Window +#define PWIN LGUI(LSFT(KC_GRV)) // Prev Window +#define NTAB LGUI(LSFT(KC_RBRC)) // Next Tab +#define PTAB LGUI(LSFT(KC_LBRC)) // Prev Tab +#define NAVBACK LGUI(KC_LBRC) // Navigate Forward +#define NAVFWD LGUI(KC_RBRC) // Navigate Back + +// my personal mappings to window manager commands +#define XALLWIN HYPR(KC_F14) +#define XDESKTP HYPR(KC_F15) +#define XNXTSPC HYPR(KC_F16) +#define XPRVSPC HYPR(KC_F17) +#define XNOTIFY HYPR(KC_F18) + +#ifdef RGBLIGHT_ENABLE +#define HSV_CAPS 42, 255, 255 +#define HSV_DEFAULT 30, 218, 255 +#define HSV_SYMBOL 22, 255, 255 +#define HSV_NAVNUM 245, 200, 255 +#define HSV_FUNCT 233, 255, 255 +#define HSV_RESET 180, 255, 255 +#endif + +#endif + diff --git a/users/mattly/readme.md b/users/mattly/readme.md new file mode 100644 index 0000000000..356992534c --- /dev/null +++ b/users/mattly/readme.md @@ -0,0 +1,10 @@ +# mattly's layouts + +My layouts are based around: + +* making the most from small layouts on keyboards like the iris or planck +* moving held-modifiers from pinkies to thumbs or home row, giving many keys dual purposes via mod/layer taps +* easy home-row navigation on a layer, using standard keys, available to all programs, not just a specially-configured editor +* easy access to punctuation symbols used in the programming languages I work in + +[Here is an image](https://lyonheart.us/etc/mattly-keymap.png) with an outdated description of my keymap
\ No newline at end of file diff --git a/users/mattly/rules.mk b/users/mattly/rules.mk new file mode 100644 index 0000000000..6803d361d8 --- /dev/null +++ b/users/mattly/rules.mk @@ -0,0 +1,2 @@ +SRC += mattly.c +MOUSEKEY_ENABLE = yes |