mattly's userspace and iris (#6279)

This commit is contained in:
Matthew Lyon 2019-07-08 06:27:30 -07:00 committed by MechMerlin
parent 7579518613
commit 06ba968759
11 changed files with 270 additions and 176 deletions

View file

@ -0,0 +1,28 @@
/*
Copyright 2017 Danny Nguyen <danny@keeb.io>
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/>.
*/
#pragma once
// #define USE_I2C
#define EE_HANDS
#undef RGBLED_NUM
#define RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 12
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8

View file

@ -0,0 +1,50 @@
#include QMK_KEYBOARD_H
#include "mattly.h"
// extern keymap_config_t keymap_config;
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_SCLN,
KC_CAPS, A_CTRL, S_ALT, D_GUI, F_SHFT, KC_G, KC_H, J_SHFT, K_GUI, L_ALT, MINSCTL, KC_QUOT,
XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, SPC_SFT, BSP_NUM, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
ESC_HYP, BSP_NUM, ENT_SFT, SPC_SFT, TAB_SYM, DEL_WRP
),
[_SYMBOL] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, KC_AMPR, KC_GRV, KC_TILD, KC_LBRC, KC_RBRC, KC_LABK, KC_RABK, KC_PLUS, KC_ASTR, XXXXXXX, _______,
_______, KC_DLR, KC_PERC, KC_EQL, KC_LPRN, KC_RPRN, KC_SCLN, KC_COLN, KC_EXLM, KC_AT, KC_UNDS, _______,
RESET, XXXXXXX, KC_CIRC, KC_HASH, KC_LCBR, KC_RCBR, _______, _______, KC_QUOT, KC_DQUO, KC_PIPE, KC_BSLS, KC_QUES, _______,
_______, _______, _______, _______, _______, _______
),
[_NAVNUM] = LAYOUT(
XNOTIFY, XXXXXXX, XPRVSPC, NWIN, XNXTSPC, XXXXXXX, XXXXXXX, KC_SLSH, KC_ASTR, KC_MINS, KC_PLUS, XXXXXXX,
XALLWIN, NAVFWD, BWORD, KC_UP, FWORD, KC_PGUP, KC_DLR, KC_P7, KC_P8, KC_P9, KC_DOT, XXXXXXX,
XDESKTP, NAVBACK, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_PERC, KC_P4, KC_P5, KC_P6, KC_EQL, XXXXXXX,
RESET, PTAB, KC_HOME, PWIN, KC_END, NTAB, _______, _______, XXXXXXX, KC_P1, KC_P2, KC_P3, KC_ENT, XXXXXXX,
_______, _______, _______, _______, _______, KC_P0
),
[_FUNCT] = LAYOUT(
KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
RESET, XALLWIN, XPRVSPC, NWIN, XNXTSPC, XDESKTP, XXXXXXX, RGB_TOG, RGB_M_P, RGB_M_B, RGB_M_K, RESET,
DEBUG, XNOTIFY, PTAB, PWIN, NTAB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_MUTE, KC_VOLD, KC_VOLU, KC_MRWD, KC_MFFD, KC_MPLY, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
_______, _______, _______, _______, _______, _______
)
};
void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
tap_code(KC_MS_WH_UP);
} else {
tap_code(KC_MS_WH_DOWN);
}
}
}

View file

@ -0,0 +1 @@
See my readme in [users/mattly](../../../../../users/mattly/readme.md)

View file

@ -1,166 +1,34 @@
/* Copyright 2015-2017 Jack Humbert
*
* 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/>.
*/
#include QMK_KEYBOARD_H
#include "muse.h"
extern keymap_config_t keymap_config;
enum planck_layers {
_QWERTY,
_NUMBER,
_SYMBOL,
_FUNC,
};
enum planck_keycodes {
QWERTY = SAFE_RANGE
};
#define SPC_SHF MT(MOD_LSFT, KC_SPC)
#define ESC_HYP MT(MOD_HYPR, KC_ESC)
#define TAB_NUM LT(_NUMBER, KC_TAB)
#define BSP_SYM LT(_SYMBOL, KC_BSPC)
#define DEL_WRP MT(MOD_LCTL | MOD_LALT | MOD_LGUI, KC_DEL)
#define SYMLOCK TG(_SYMBOL)
#define NUMLOCK TG(_NUMBER)
#define ONE_CTL OSM(MOD_LCTL)
#define ONE_ALT OSM(MOD_LALT)
#define ONE_GUI OSM(MOD_LGUI)
#define ONE_HYP OSM(MOD_HYPR)
#define ONE_MEH OSM(MOD_MEH)
#define ONE_WRP OSM(MOD_LCTL | MOD_LALT | MOD_LGUI)
#define ONE_WOA OSM(MOD_LCTL | MOD_LGUI | MOD_LSFT)
#define ONE_DER OSM(MOD_LALT | MOD_LGUI | MOD_LSFT)
#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 ENT_CTL MT(MOD_LCTL, KC_ENT)
#define LT_ALT MT(MOD_LALT, KC_LEFT)
#define DN_GUI MT(MOD_LGUI, KC_DOWN)
#define RT_SHFT MT(MOD_LSFT, KC_RGHT)
#define N4_SHFT MT(MOD_RSFT, KC_4)
#define N5_GUI MT(MOD_RGUI, KC_5)
#define N6_ALT MT(MOD_RALT, KC_6)
#define BWORD LALT(KC_LEFT)
#define FWORD LALT(KC_RIGHT)
#define NWIN LGUI(KC_GRV)
#define PWIN LGUI(LSFT(KC_GRV))
#define NTAB LGUI(LSFT(KC_RBRC))
#define PTAB LGUI(LSFT(KC_LBRC))
#define NAVBACK LGUI(KC_LBRC)
#define NAVFWD LGUI(KC_RBRC)
#define XMSNCTL HYPR(KC_F14)
#define XDSKTOP HYPR(KC_F15)
#define XNXTSPC HYPR(KC_F16)
#define XPRVSPC HYPR(KC_F17)
#define XNOTIFY HYPR(KC_F18)
#include "mattly.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Querty
| # | q | w | e | r | t | y | u | i | o | p | - |
| | | | | | | | | | | | |
|------|------|------|------|------|------|------|------|------|------|------|------|
| ( | a | s | d | f | g | h | j | k | l | ; | ' |
| | CTRL | ALT | GUI | SHIFT| | | SHIFT| GUI | ALT | CTRL | |
|------|------|------|------|------|------|------|------|------|------|------|------|
| [ | z | x | c | v | b | n | m | , | . | / | > |
| | | | | | | | | | | | |
|------|------|------|------|------|------|------|------|------|------|------|------|
| ctrl | alt | gui | Esc | Tab | space | Bksp | Del | hyper| meh | warp |
| | | | FUNC |NUMBER| SHIFT |SYMBOL| | | | |
*/
[_QWERTY] = LAYOUT_planck_grid(
KC_HASH, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_SCLN,
KC_LPRN, A_CTRL, S_ALT, D_GUI, F_SHFT, KC_G, KC_H, J_SHFT, K_GUI, L_ALT, MINSCTL, KC_QUOT,
KC_LBRC, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RABK,
NUMLOCK, MO(_FUNC), ONE_MEH, ESC_HYP, TAB_NUM, SPC_SHF, SPC_SHF, BSP_SYM, DEL_WRP, ONE_WRP, ONE_DER, SYMLOCK
XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_SCLN,
KC_CAPS, A_CTRL, S_ALT, D_GUI, F_SHFT, KC_G, KC_H, J_SHFT, K_GUI, L_ALT, MINSCTL, KC_QUOT,
XXXXXXX, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
XXXXXXX, NAVLOCK, XXXXXXX, ESC_HYP, BSP_NUM, ENT_SFT, SPC_SFT, TAB_SYM, DEL_WRP, XXXXXXX, SYMLOCK, XXXXXXX
),
/* Symbol
| | & | ` | ~ | [ | ] | < | > | + | | | | |
| | $ | % | = | ( | ) | ; | : | ! | @ | _ | |
| | | ^ | # | { | } | ' | " | | | \ | ? | |
| | | | | | | .... | | | | |
*/
[_SYMBOL] = LAYOUT_planck_grid(
KC_ESC, KC_AMPR, KC_GRV, KC_TILD, KC_LBRC, KC_RBRC, KC_LABK, KC_RABK, KC_PLUS, KC_ASTR, XXXXXXX, KC_DEL,
KC_ENT, KC_DLR, KC_PERC, KC_EQL, KC_LPRN, KC_RPRN, KC_SCLN, KC_COLN, KC_EXLM, KC_AT, KC_UNDS, KC_BSPC,
_______, KC_AMPR, KC_GRV, KC_TILD, KC_LBRC, KC_RBRC, KC_LABK, KC_RABK, KC_PLUS, KC_ASTR, XXXXXXX, _______,
_______, KC_DLR, KC_PERC, KC_EQL, KC_LPRN, KC_RPRN, KC_SCLN, KC_COLN, KC_EXLM, KC_AT, KC_UNDS, _______,
_______, XXXXXXX, KC_CIRC, KC_HASH, KC_LCBR, KC_RCBR, KC_QUOT, KC_DQUO, KC_PIPE, KC_BSLS, KC_QUES, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
/* Number
| | |<-word| up |word->| PgUp | . | 7 | 8 | 9 | + | * |
| | Enter| left | down | right| PgDn | 0 | 4 | 5 | 6 | - | / |
| | Bksp | Home | tab | End | Del | , | 1 | 2 | 3 | = | % |
| | | | | .... | | | | : | $ | |
*/
[_NUMBER] = LAYOUT_planck_grid(
XXXXXXX, XXXXXXX, BWORD, KC_UP, FWORD, KC_PGUP, KC_DOT, KC_7, KC_8, KC_9, KC_PLUS, KC_ASTR,
KC_CAPS, ENT_CTL, LT_ALT, DN_GUI, RT_SHFT, KC_PGDN, KC_0, N4_SHFT, N5_GUI, N6_ALT, MINSCTL, KC_SLSH,
XXXXXXX, KC_BSPC, KC_HOME, KC_TAB, KC_END, KC_DEL, KC_COMM, KC_1, KC_2, KC_3, KC_EQL, KC_PERC,
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_COLN, KC_DLR, _______
[_NAVNUM] = LAYOUT_planck_grid(
_______, XXXXXXX, BWORD, KC_UP, FWORD, KC_PGUP, KC_DOT, KC_7, KC_8, KC_9, KC_PLUS, KC_ASTR,
_______, KC_ENT, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_0, KC_4, KC_5, KC_6, KC_MINS, KC_SLSH,
_______, KC_BSPC, KC_HOME, KC_TAB, KC_END, KC_DEL, KC_COMM, KC_1, KC_2, KC_3, KC_EQL, KC_PERC,
_______, _______, _______, _______, _______, _______, _______, _______, KC_0, KC_COLN, KC_DLR, _______
),
/* Function
* | Reset| Mctl | Pspc | Nwin | Nspc | Desk | | F7 | F8 | F9 | F10 | F13 |
* | Debug| Nctr | Ptab | Pwin | Ntab | Back | Fwd | F4 | F5 | F6 | F11 | F14 |
* | Mute | Vol- | Vol+ | Trk- | Trk+ | Play | | F1 | F2 | F3 | F12 | F15 |
* | | | | | | | | | | | | |
*/
[_FUNC] = LAYOUT_planck_grid(
RESET, XMSNCTL, XPRVSPC, NWIN, XNXTSPC, XDSKTOP, XXXXXXX, KC_F7, KC_F8, KC_F9, KC_F10, KC_F13,
[_FUNCT] = LAYOUT_planck_grid(
RESET, XALLWIN, XPRVSPC, NWIN, XNXTSPC, XDESKTP, XXXXXXX, KC_F7, KC_F8, KC_F9, KC_F10, KC_F13,
DEBUG, XNOTIFY, PTAB, PWIN, NTAB, NAVBACK, NAVFWD, KC_F4, KC_F5, KC_F6, KC_F11, KC_F14,
KC_MUTE, KC_VOLD, KC_VOLU, KC_MRWD, KC_MFFD, KC_MPLY, XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F12, KC_F15,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
)
};
#ifdef AUDIO_ENABLE
#endif
uint32_t layer_state_set_user(uint32_t state) {
state = update_tri_layer_state(state, _SYMBOL, _NUMBER, _FUNC);
return state;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
print("mode just switched to qwerty and this is a huge string\n");
set_single_persistent_default_layer(_QWERTY);
}
return false;
break;
}
return true;
}

View file

@ -1,28 +1 @@
# Mattly's Planck layout
This planck layout is optimized for, in order:
- moving work from my pinkies to my thumbs
- writing lisp/clojure code in my evil-mode based emacs setup
- tapping out messages in chat applications such as slack
- writing english in markdown files in said emacs
- navigating mac applications
- writing english in a web browser on a macintosh
- writing other programming languages' code in said emacs
- writing english in other contexts
- literally anything else
## oddities:
You may notice that `enter` is on a layer. This is an experiment and I kind of
like it so far, since many programs interpret that keystroke as a "commit"
of some kind.
## works in progress
I'm trying to figure out how to make some things easier to do with the mouse or
one-handed. Right now the combo of entering numbers and using a mouse with my
right hand is kind of annoying. I want to be able to toggle layers on, but only
from within that layer.
![mattly's keymap](https://lyonheart.us/etc/mattly-keymap.png)
See my readme in [users/mattly](../../../../../users/mattly/readme.md)

9
users/mattly/config.h Normal file
View file

@ -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

70
users/mattly/mattly.c Normal file
View file

@ -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
}

83
users/mattly/mattly.h Normal file
View file

@ -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

10
users/mattly/readme.md Normal file
View file

@ -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

2
users/mattly/rules.mk Normal file
View file

@ -0,0 +1,2 @@
SRC += mattly.c
MOUSEKEY_ENABLE = yes