From e59f331268e28657954bdc7aa2f2eab09796610b Mon Sep 17 00:00:00 2001 From: Matthew Lyon Date: Tue, 18 Dec 2018 08:37:04 -0800 Subject: [PATCH] Keymap: @mattly's planck layout (#4678) --- keyboards/planck/keymaps/mattly/config.h | 43 ++++++ keyboards/planck/keymaps/mattly/keymap.c | 176 ++++++++++++++++++++++ keyboards/planck/keymaps/mattly/readme.md | 28 ++++ keyboards/planck/keymaps/mattly/rules.mk | 2 + 4 files changed, 249 insertions(+) create mode 100644 keyboards/planck/keymaps/mattly/config.h create mode 100644 keyboards/planck/keymaps/mattly/keymap.c create mode 100644 keyboards/planck/keymaps/mattly/readme.md create mode 100644 keyboards/planck/keymaps/mattly/rules.mk diff --git a/keyboards/planck/keymaps/mattly/config.h b/keyboards/planck/keymaps/mattly/config.h new file mode 100644 index 000000000..52e39ec7f --- /dev/null +++ b/keyboards/planck/keymaps/mattly/config.h @@ -0,0 +1,43 @@ +#pragma once + +#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 + +/* + * 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 + +#define IGNORE_MOD_TAP_INTERRUPT +#define PERMISSIVE_HOLD +#define TAPPING_TOGGLE 2 +#define TAPPING_TERM 200 diff --git a/keyboards/planck/keymaps/mattly/keymap.c b/keyboards/planck/keymaps/mattly/keymap.c new file mode 100644 index 000000000..2495f8a19 --- /dev/null +++ b/keyboards/planck/keymaps/mattly/keymap.c @@ -0,0 +1,176 @@ +/* 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 . + */ + +#include QMK_KEYBOARD_H +#include "muse.h" + +extern keymap_config_t keymap_config; + +enum planck_layers { + _QWERTY, + _NUMBER, + _SYMBOL, + _FUNC, + _ADJUST +}; + +enum planck_keycodes { + QWERTY = SAFE_RANGE +}; + +#define SPC_SHF MT(MOD_LSFT, KC_SPC) + +#define ENT_FUN LT(_FUNC, KC_ENT) +#define ESC_FUN LT(_FUNC, KC_ESC) +#define TAB_NUM LT(_NUMBER, KC_TAB) +#define BSP_SYM LT(_SYMBOL, KC_BSPC) +#define DEL_ADJ LT(_ADJUST, 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 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 G_NUM LT(_NUMBER, KC_G) +#define H_NAV LT(_SYMBOL, KC_H) +#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 SCL_CTL MT(MOD_RCTL, KC_SCLN) + +#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 XMSNCTL HYPR(KC_F14) +#define XDSKTOP HYPR(KC_F15) +#define XNXTSPC HYPR(KC_F16) +#define XPRVSPC HYPR(KC_F17) +#define XNOTIFY HYPR(KC_F18) + +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| NUMBR| SYMBL| 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, G_NUM, H_NAV, 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, + KC_CAPS, ONE_ALT, ONE_GUI, ESC_FUN, TAB_NUM, SPC_SHF, SPC_SHF, BSP_SYM, DEL_ADJ, ONE_HYP, ONE_MEH, ONE_WRP + ), + +/* Symbol + | | & | ` | ~ | [ | ] | < | > | + | | | | - | + | | $ | % | = | ( | ) | | : | ! | @ | * | ' | + | | | ^ | # | { | } | | " | | | \ | | | + | | | | | LOCK | | .... | | | | | + */ + [_SYMBOL] = LAYOUT_planck_grid( + _______, 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_ASTR, _______, + _______, XXXXXXX, KC_CIRC, KC_HASH, KC_LCBR, KC_RCBR, KC_QUOT, KC_DQUO, KC_PIPE, KC_BSLS, XXXXXXX, _______, + _______, _______, _______, _______, SYMLOCK, _______, _______, _______, _______, _______, _______, _______ + ), +/* 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 | = | % | + | | | | | .... | | LOCK | | : | $ | | + */ +[_NUMBER] = LAYOUT_planck_grid( + XXXXXXX, _______, BWORD, KC_UP, FWORD, KC_PGUP, KC_DOT, KC_7, KC_8, KC_9, KC_PLUS, KC_ASTR, + XXXXXXX, KC_ENT , KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_0, KC_4, KC_5, KC_6, KC_MINS, 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, + _______, _______, _______, _______, _______, _______, _______, NUMLOCK, _______, KC_COLN, KC_DLR, _______ +), +/* Function + * | | Mctl | Pspc | Nwin | Nspc | Desk | | F7 | F8 | F9 | F10 | F13 | + * | | Nctr | Ptab | Pwin | Ntab | | | F4 | F5 | F6 | F11 | F14 | + * | Mute | Vol- | Vol+ | Trk- | Trk+ | Play | | F1 | F2 | F3 | F12 | F15 | + * | | | | | | | | | | | | | + */ +[_FUNC] = LAYOUT_planck_grid( + XXXXXXX, XMSNCTL, XPRVSPC, NWIN, XNXTSPC, XDSKTOP, XXXXXXX, KC_F7, KC_F8, KC_F9, KC_F10, KC_F13, + XXXXXXX, XNOTIFY, PTAB, PWIN, NTAB, XXXXXXX, XXXXXXX, 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, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +), + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | Reset| Debug| | | | | | | | | | | + * | | | | | | | | | | | | | + * | | | | | | | | | | | | | + * | | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = LAYOUT_planck_grid( + RESET, DEBUG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ +) + + +}; + +#ifdef AUDIO_ENABLE +#endif + +uint32_t layer_state_set_user(uint32_t state) { + /* state = update_tri_layer_state(state, _SYMBOL, _NUMBER, _ADJUST); */ + 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; +} + + diff --git a/keyboards/planck/keymaps/mattly/readme.md b/keyboards/planck/keymaps/mattly/readme.md new file mode 100644 index 000000000..58f2b979c --- /dev/null +++ b/keyboards/planck/keymaps/mattly/readme.md @@ -0,0 +1,28 @@ +# 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) diff --git a/keyboards/planck/keymaps/mattly/rules.mk b/keyboards/planck/keymaps/mattly/rules.mk new file mode 100644 index 000000000..7210cf34f --- /dev/null +++ b/keyboards/planck/keymaps/mattly/rules.mk @@ -0,0 +1,2 @@ +AUDIO_ENABLE = yes +SRC += muse.c