Merge pull request #1003 from mneme/master

Layout "Mneme" for Atreus62
This commit is contained in:
Jack Humbert 2017-01-15 01:12:04 -05:00 committed by GitHub
commit b2dcac9655
8 changed files with 519 additions and 0 deletions

View File

@ -0,0 +1,5 @@
TAP_DANCE_ENABLE = yes
NKRO_ENABLE = true
MOUSEKEY_ENABLE = no
EXTRAKEY_ENABLE = yes
CONSOLE_ENABLE = no

View File

@ -0,0 +1,56 @@
<!-- -*- mode: markdown; fill-column: 8192 -*- -->
Mnemes Swedish Bonaza
=======================
My Layout in process, most of the code is shamelessly stolen from [algernons][algernon] excellent layout
[algernon]: https://github.com/algernon/ergodox-layout
It's for Windows (current work forces me to) and Swedish (matter of birth) so ymmw.
## Table of Contents
* [Layouts](#layouts)
- [Base layer](#base-layer)
- [Nav layer](#nav-layer)
- [Sym layer](#sym-layer)
- [LED states](#led-states)
# Layouts
## Base layer
![Base layer](img/base.png)
* The number row doubles as a function row. Short presses produces numbers, long presses produces Fxx
* The `Shift`, `Alt`, and `Control` modifiers are one-shot.
* `Backspace` and `Enter` doubles as switches to the `sym` layer when held
* The `ESC` key also doubles as a one-shot cancel key.
* The **Lead** key is followed by a sequence of keys.
- `LEAD l` : `lgui+l`.
- `LEAD s l` : `λ`.
- `LEAD s s` : `¯\_(ツ)_/¯`
- `LEAD s f` : `凸(ツ)凸`
- `LEAD a *` : Application switching based on position in start menu. Very specific to my computer.
## Nav layer
![Nav layer](img/fun.png)
Basic navigation on the right hand and modifiers close
by for the left. The latter because I tend to use `ctrl+arrows` quite a lot.
## Sym layer
![Sym layer](img/sym.png)
* Easy access to most symbols I use on a daily basis. Most common are on the home row, the rest are grouped as best as I could.
- `eq` : Tapdance, produces `===` and `!==`
- `fun`: Tapdance, produces `=>` and `() => {\n`
# License
GPL-3+

View File

@ -0,0 +1,7 @@
#define ONESHOT_TIMEOUT 3000
#define TAPPING_TERM 200
#define PREVENT_STUCK_MODIFIERS
#define LEADER_TIMEOUT 1000
#include "../../config.h"

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 423 KiB

View File

@ -0,0 +1,337 @@
#include <stdarg.h>
#include "atreus62.h"
#include "led.h"
#include "action_layer.h"
#include "action_util.h"
/*
*WINDOWS SWEDISH
*/
#define KN_HALF KC_GRV // 1/2
#define KN_PLUS KC_MINS // +
#define KN_ACUT KC_EQL // ´
#define KN_AO KC_LBRC // Å
#define KN_UMLA KC_RBRC // ¨
#define KN_OE KC_SCLN // Ö
#define KN_AE KC_QUOT // Ä
#define KN_QUOT KC_NUHS // '
#define KN_LABK KC_NUBS // <
#define KN_MINS KC_SLSH // -
#define KN_EXLM LSFT(KC_1) // !
#define KN_DQT LSFT(KC_2) // "
#define KN_AT RALT(KC_2) // @
#define KN_HASH LSFT(KC_3) // #
#define KN_DLR RALT(KC_4) // $
#define KN_PERC LSFT(KC_5) // %
#define KN_AMPR LSFT(KC_6) // &
#define KN_SLSH LSFT(KC_7) // /
#define KN_LPRN LSFT(KC_8) // (
#define KN_RPRN LSFT(KC_9) // )
#define KN_EQL LSFT(KC_0) // =
#define KN_UNDS LSFT(KN_MINS) // _
#define KN_QUES LSFT(KN_PLUS) // ?
#define KN_GRAV LSFT(KN_ACUT) // `
#define KN_LCBR RALT(KC_7) // {
#define KN_RCBR RALT(KC_0) // }
#define KN_LBRC RALT(KC_8) // [
#define KN_RBRC RALT(KC_9) // ]
#define KN_RABK LSFT(KN_LABK) // <
#define KN_COLN LSFT(KC_DOT) // :
#define KN_SCLN LSFT(KC_COMM) // :
#define KN_PIPE RALT(KN_LABK) // |
#define KN_QUES LSFT(KN_PLUS) // ?
#define KN_CIRC LSFT(KN_UMLA) // ^
#define KN_ASTR LSFT(KN_QUOT) // *
#define KN_TILD RALT(KN_UMLA) // ~
#define KN_BSLS RALT(KN_PLUS) //
#define OSM_LCTL OSM(MOD_LCTL)
#define OSM_LALT OSM(MOD_LALT)
#define OSM_LSFT OSM(MOD_LSFT)
#define KC_HYP LSFT(LALT(LCTL(KC_LGUI)))
#define KC_COPY LCTL(KC_C)
#define KC_PASTE LCTL(KC_V)
#define KC_UNDO LCTL(KC_Z)
#define KC_REDO LCTL(LSFT(KC_Z))
// Layers
enum {
BASE = 0,
NAV,
SYM
};
//Macros
enum {
KF_1 = 0, // 1, F1
KF_2, // ...
KF_3,
KF_4,
KF_5,
KF_6,
KF_7,
KF_8,
KF_9,
KF_10,
KF_11,
KF_12
};
// Tapdance
enum {
TD_FUN = 0,
TD_EQ
};
//Custom keycodes
enum {
PLACEHOLDER = SAFE_RANGE
};
//State and timers
uint16_t kf_timers[12];
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = {
{ M(KF_11) ,M(KF_1) ,M(KF_2) ,M(KF_3) ,M(KF_4) ,M(KF_5) ,KC_NO ,M(KF_6) ,M(KF_7) ,M(KF_8) ,M(KF_9) ,M(KF_10) ,M(KF_12) },
{ KC_TAB ,KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_NO ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,KN_AO },
{ OSM_LCTL ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G ,KC_NO ,KC_H ,KC_J ,KC_K ,KC_L ,KN_OE ,KN_AE },
{ OSM_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,KC_DELT ,KC_N ,KC_M ,KC_COMM ,KC_DOT ,KN_MINS ,OSM_LSFT },
{ MO(NAV) ,OSM_LCTL ,OSM_LALT ,KC_LGUI ,KC_SPC ,LT(SYM,KC_BSPC) ,KC_HYP ,LT(SYM,KC_ENT) ,KC_SPC ,KC_LEAD ,KC_LALT ,KC_LCTRL ,MO(NAV) }
},
[NAV] = {
{ KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRN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TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS }
}
};
#define TAP_ONCE(code) \
register_code (code); \
unregister_code (code)
static void m_tapn (uint8_t code, ...) {
uint8_t kc = code;
va_list ap;
va_start(ap, code);
do {
register_code(kc);
unregister_code(kc);
wait_ms(50);
kc = va_arg(ap, int);
} while (kc != 0);
va_end(ap);
}
static void m_handle_kf (keyrecord_t *record, uint8_t id) {
uint8_t code = id - KF_1;
if (record->event.pressed) {
kf_timers[code] = timer_read ();
} else {
uint8_t kc_base;
uint8_t long_press = (kf_timers[code] && timer_elapsed (kf_timers[code]) > TAPPING_TERM);
kf_timers[code] = 0;
switch(id){
case KF_1 ... KF_10:
if (long_press) {
// Long press
kc_base = KC_F1;
} else {
kc_base = KC_1;
}
code += kc_base;
break;
case KF_11:
code = long_press ? KC_F11 : KC_ESC;
break;
case KF_12:
code = long_press ? KC_F12 : KN_PLUS;
break;
}
register_code (code);
unregister_code (code);
}
}
const uint16_t PROGMEM fn_actions[] = {
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch (id) {
case KF_1 ... KF_12:
m_handle_kf(record, id);
break;
}
return MACRO_NONE;
};
// Custom keycodes
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
bool queue = true;
//Cancle one-shot mods.
switch (keycode) {
case KC_ESC:
if (record->event.pressed && get_oneshot_mods() && !has_oneshot_mods_timed_out()) {
clear_oneshot_mods();
queue = false;
}
break;
}
return queue;
}
// TAP DANCE SETTINGS
void dance_eq (qk_tap_dance_state_t *state, void *user_data) {
switch (state->count) {
case 1: // ===
register_code(KC_LSHIFT);
m_tapn(KC_0, KC_0, KC_0, 0);
unregister_code(KC_LSHIFT);
break;
case 2:
register_code(KC_LSHIFT);
m_tapn(KC_1, KC_0, KC_0, 0);
unregister_code(KC_LSHIFT);
break;
default:
reset_tap_dance(state);
}
}
void dance_fun (qk_tap_dance_state_t *state, void *user_data) {
switch (state->count) {
case 1: // =>
register_code(KC_LSHIFT);
m_tapn(KC_0, KN_LABK, 0);
unregister_code(KC_LSHIFT);
break;
case 2: // () => {}
register_code(KC_LSHIFT);
m_tapn(KC_8, KC_9, KC_SPC, KC_0, KN_LABK, KC_SPC, 0);
unregister_code(KC_LSHIFT);
register_code(KC_RALT);
m_tapn(KC_7, 0);
unregister_code(KC_RALT);
TAP_ONCE(KC_ENT);
break;
default:
reset_tap_dance(state);
}
}
qk_tap_dance_action_t tap_dance_actions[] = {
[TD_FUN] = ACTION_TAP_DANCE_FN (dance_fun)
,[TD_EQ] = ACTION_TAP_DANCE_FN (dance_eq)
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
set_unicode_input_mode(UC_WINC);
};
LEADER_EXTERNS();
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
LEADER_DICTIONARY() {
leading = false;
leader_end();
SEQ_ONE_KEY(KC_L){
register_code(KC_RGUI);
TAP_ONCE(KC_L);
unregister_code(KC_RGUI);
};
SEQ_TWO_KEYS (KC_A, KC_W) {
//Web - chrome
register_code (KC_LGUI); TAP_ONCE (KC_1); unregister_code (KC_LGUI);
}
SEQ_TWO_KEYS (KC_A, KC_P) {
//sPotify
register_code (KC_LGUI); TAP_ONCE (KC_2); unregister_code (KC_LGUI);
}
SEQ_TWO_KEYS (KC_A, KC_T) {
//Total Commander
register_code (KC_LGUI); TAP_ONCE (KC_3); unregister_code (KC_LGUI);
}
SEQ_TWO_KEYS (KC_A, KC_A) {
//Atom
register_code (KC_LGUI); TAP_ONCE (KC_4); unregister_code (KC_LGUI);
}
SEQ_TWO_KEYS (KC_A, KC_E) {
//Emacs
register_code (KC_LGUI); TAP_ONCE (KC_5); unregister_code (KC_LGUI);
}
SEQ_TWO_KEYS (KC_A, KC_C) {
//Cmdr
register_code (KC_LGUI); TAP_ONCE (KC_6); unregister_code (KC_LGUI);
}
SEQ_TWO_KEYS (KC_A, KC_S) {
//Slack
register_code (KC_LGUI); TAP_ONCE (KC_7); unregister_code (KC_LGUI);
}
SEQ_TWO_KEYS (KC_S, KC_S) {
// ¯\_(ツ)_/¯
unicode_input_start(); register_hex(0xaf); unicode_input_finish();
register_code (KC_LALT);
register_code (KC_LCTL);
TAP_ONCE (KN_PLUS);
unregister_code (KC_LCTL);
unregister_code (KC_LALT);
register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
register_code (KC_RSFT); TAP_ONCE (KC_9); TAP_ONCE(KC_7); unregister_code (KC_RSFT);
unicode_input_start (); register_hex(0xaf); unicode_input_finish();
}
SEQ_TWO_KEYS (KC_S, KC_F) {
// 凸(ツ)凸
unicode_input_start(); register_hex(0x51F8); unicode_input_finish();
register_code (KC_RSFT); TAP_ONCE (KC_8); unregister_code (KC_RSFT);
unicode_input_start (); register_hex(0x30c4); unicode_input_finish();
register_code (KC_RSFT); TAP_ONCE (KC_9); unregister_code (KC_RSFT);
unicode_input_start (); register_hex(0x51F8); unicode_input_finish();
}
SEQ_TWO_KEYS (KC_S, KC_L) {
// λ
unicode_input_start();
register_hex(0x03bb);
unicode_input_finish();
}
};
};

View File

@ -0,0 +1,114 @@
Todo
☐ 2610 Todo
☑ 2611 Done
☒ 2612 Failed
Operator
× 00D7 Multiplication
÷ 00F7 Division
≤ 2264 LessEqual
≥ 2265 MoreEqual
± 00B1 Plusminus
Math
∏ 220F Product
∑ 2211 Sum
≈ 2248 Almost
≡ 2261 Equivalent
∞ 221E Infinity
‰ 2030 Mille
Set
⊂ 2282 Subset
⊃ 2283 sUperset
∩ 2229 Intersextion
222A Union
∈ 2208 Element
∉ 2209 Notelement
∍ 220D Contains
∌ 220C doesNotcontain
Logic
¬ 00AC Not
∧ 2227 And
2228 Or
∃ 2203 Exists
∄ 2204 Notexists
Greek
µ 00B5 Micro
λ 03BB Lamda
Ω 2126 Omega
α 03B1 Alpha
β 03B2 Beta
γ 03B3 Gamma
π 03C0 Pi
δ 03B4 Delta
Other
☁ 2601 Cloud
☼ 263C Sun
☂ 2602 Rain
☠ 2620 Skull
♺ 267A Recycle
👍1F44D thumbsUp
👎1F44E thumbsDown
💩 1F4A9 Poo
//Todo
SEQ_THREE_KEYS(KC_U, KC_G, KC_T){m_unicode(0x2610);}; // Todo
SEQ_THREE_KEYS(KC_U, KC_G, KC_D){m_unicode(0x2611);}; // Done
SEQ_THREE_KEYS(KC_U, KC_G, KC_F){m_unicode(0x2612);}; // Failed
//Operator
SEQ_THREE_KEYS(KC_U, KC_O, KC_M){m_unicode(0x00D7);}; // Multiplication
SEQ_THREE_KEYS(KC_U, KC_O, KC_D){m_unicode(0x00F7);}; // Division
SEQ_THREE_KEYS(KC_U, KC_O, KC_L){m_unicode(0x2264);}; // LessEqual
SEQ_THREE_KEYS(KC_U, KC_O, KC_M){m_unicode(0x2265);}; // MoreEqual
SEQ_THREE_KEYS(KC_U, KC_O, KC_P){m_unicode(0x00B1);}; // Plusminus
//Math
SEQ_THREE_KEYS(KC_U, KC_M, KC_P){m_unicode(0x220F);}; // Product
SEQ_THREE_KEYS(KC_U, KC_M, KC_S){m_unicode(0x2211);}; // Sum
SEQ_THREE_KEYS(KC_U, KC_M, KC_A){m_unicode(0x2248);}; // Almost
SEQ_THREE_KEYS(KC_U, KC_M, KC_E){m_unicode(0x2261);}; // Equivalent
SEQ_THREE_KEYS(KC_U, KC_M, KC_I){m_unicode(0x221E);}; // Infinity
SEQ_THREE_KEYS(KC_U, KC_M, KC_M){m_unicode(0x2030);}; // Mille
//Set
SEQ_THREE_KEYS(KC_U, KC_S, KC_S){m_unicode(0x2282);}; Subset
SEQ_THREE_KEYS(KC_U, KC_S, KC_P){m_unicode(0x2283);}; suPerset
SEQ_THREE_KEYS(KC_U, KC_S, KC_I){m_unicode(0x2229);}; Intersection
SEQ_THREE_KEYS(KC_U, KC_S, KC_U){m_unicode(0x222A);}; Union
SEQ_THREE_KEYS(KC_U, KC_S, KC_E){m_unicode(0x2208);}; Element
SEQ_THREE_KEYS(KC_U, KC_S, KC_N){m_unicode(0x2209);}; Notelement
SEQ_THREE_KEYS(KC_U, KC_S, KC_C){m_unicode(0x220D);}; Contains
SEQ_THREE_KEYS(KC_U, KC_S, KC_D){m_unicode(0x220C);}; doesNotcontain
//Logic
SEQ_THREE_KEYS(KC_U, KC_L, KC_N){m_unicode(0x00AC);}; // Not
SEQ_THREE_KEYS(KC_U, KC_L, KC_A){m_unicode(0x2227);}; // And
SEQ_THREE_KEYS(KC_U, KC_L, KC_O){m_unicode(0x2228);}; // Or
SEQ_THREE_KEYS(KC_U, KC_L, KC_E){m_unicode(0x2203);}; // Exists
SEQ_THREE_KEYS(KC_U, KC_L, KC_N){m_unicode(0x2204);}; // Notexists
//Greek
SEQ_THREE_KEYS(KC_U, KC_G, KC_M){m_unicode(0x00B5);}; // Micro
SEQ_THREE_KEYS(KC_U, KC_G, KC_L){m_unicode(0x03BB);}; // Lamda
SEQ_THREE_KEYS(KC_U, KC_G, KC_O){m_unicode(0x2126);}; // Omega
SEQ_THREE_KEYS(KC_U, KC_G, KC_A){m_unicode(0x03B1);}; // Alpha
SEQ_THREE_KEYS(KC_U, KC_G, KC_B){m_unicode(0x03B2);}; // Beta
SEQ_THREE_KEYS(KC_U, KC_G, KC_G){m_unicode(0x03B3);}; // Gamma
SEQ_THREE_KEYS(KC_U, KC_G, KC_P){m_unicode(0x03C0);}; // Pi
SEQ_THREE_KEYS(KC_U, KC_G, KC_D){m_unicode(0x03B4);}; // Delta
//Zother
SEQ_THREE_KEYS(KC_U, KC_Z, KC_C){m_unicode(0x2601);}; // Cloud
SEQ_THREE_KEYS(KC_U, KC_Z, KC_S){m_unicode(0x263C);}; // Sun
SEQ_THREE_KEYS(KC_U, KC_Z, KC_R){m_unicode(0x2602);}; // Rain
SEQ_THREE_KEYS(KC_U, KC_Z, KC_K){m_unicode(0x2620);}; // sKull
SEQ_THREE_KEYS(KC_U, KC_Z, KC_R){m_unicode(0x267A);}; // rEcycle
SEQ_THREE_KEYS(KC_U, KC_Z, KC_U){m_unicode(0x1F44D);}; // thumbsUp
SEQ_THREE_KEYS(KC_U, KC_Z, KC_D){m_unicode(0x1F44E);}; // thumbsDown
SEQ_THREE_KEYS(KC_U, KC_Z, KC_P){m_unicode(0x1F4A9);}; // Poo