Skip to content

Commit

Permalink
The PoweredByPorridge layout for the Keyboardio Atreus (#21737)
Browse files Browse the repository at this point in the history
Co-authored-by: jack <[email protected]>
  • Loading branch information
PoweredByPorridge and waffle87 authored Aug 16, 2023
1 parent dea2d94 commit 190738c
Show file tree
Hide file tree
Showing 4 changed files with 311 additions and 0 deletions.
45 changes: 45 additions & 0 deletions keyboards/keyboardio/atreus/keymaps/poweredbyporridge/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* Copyright 2023 @PoweredByPorridge
*
* 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 AUTO_SHIFT_TIMEOUT 210

#define NO_AUTO_SHIFT_NUMERIC
// #define NO_AUTO_SHIFT_SPECIAL

// retro shift is auto shift on home row mods
// I no longer use home row mods, but do find this setting helps
// avoid 'fat fingered' keypresses.

// If RETRO_SHIFT is defined to a value, hold times greater
// than that value will not produce a tap on release. This enables
// modifiers to be held for combining with mouse clicks without
// generating taps on release.
#define RETRO_SHIFT 425

// can also be defined without a value
// #define RETRO_SHIFT

// Configure the global tapping term (default: 200ms)
// Lower than 210 and I can't tap dance brackets without a run up.
#define TAPPING_TERM 210

#define TAPPING_TERM_PER_KEY

// Apply the modifier on keys that are tapped during a short hold of a modtap
// Prevents slurred typing (of home row mods)
#define PERMISSIVE_HOLD
224 changes: 224 additions & 0 deletions keyboards/keyboardio/atreus/keymaps/poweredbyporridge/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
/* Copyright 2023 @PoweredByPorridge
*
* 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

// Tap Dance keycodes
enum td_keycodes {
L_BRAX, // Used in the keymap, add additional keycodes for each tapdance.
R_BRAX,
QUOTS,
TACHE
};

// Define a type containing as many tapdance states as you need
typedef enum {
SINGLE_TAP,
DOUBLE_TAP, // SINGLE_HOLD,
TRIPLE_TAP // DOUBLE_SINGLE_TAP
} td_state_t;

// Create a global instance of the tapdance state type
static td_state_t td_state;

// Declare your tapdance functions:

// Function to determine the current tapdance state
uint8_t cur_dance(tap_dance_state_t *state);

// `finished` and `reset` functions for each tapdance keycode
void lbrax_finished(tap_dance_state_t *state, void *user_data);
void lbrax_reset(tap_dance_state_t *state, void *user_data);

void rbrax_finished(tap_dance_state_t *state, void *user_data);
void rbrax_reset(tap_dance_state_t *state, void *user_data);

void quots_finished(tap_dance_state_t *state, void *user_data);
void quots_reset(tap_dance_state_t *state, void *user_data);

void tache_finished(tap_dance_state_t *state, void *user_data);
void tache_reset(tap_dance_state_t *state, void *user_data);

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT(KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,
KC_Z, KC_X, KC_C, KC_V, KC_B, KC_NUBS, KC_SLSH, KC_N, KC_M, KC_COMM, KC_DOT, KC_ENT,
LCTL_T(KC_ESC), KC_LALT, KC_LGUI, KC_LSFT, MO(1), KC_SPC, KC_SPC, MO(2), TD(QUOTS), KC_RSFT, KC_LALT, LCTL_T(KC_TAB)),

[1] = LAYOUT(KC_EXLM, KC_DQUO, LSFT(KC_3), KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_DEL, KC_BSPC,
KC_F24, LALT(KC_F3), KC_NO, KC_NO, TD(L_BRAX), TD(R_BRAX), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT,
LCTL(KC_F12), LALT(KC_X), KC_NO, KC_NO, KC_NO, TD(QUOTS), TD(TACHE), KC_MINS, KC_EQL, KC_COMM, KC_DOT, KC_ENT,
KC_TRNS, KC_NO, KC_NO, MO(3), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, LSFT(KC_TAB)),

[2] = LAYOUT(KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,
KC_NO, LALT(KC_F3), KC_NO, KC_NO, TD(L_BRAX), TD(R_BRAX), KC_HOME, KC_PGDN, KC_PGUP, KC_END,
LCTL(KC_F12), LALT(KC_X), KC_NO, KC_NO, KC_NO, TD(QUOTS), TD(TACHE), KC_MINS, KC_EQL, KC_COMM, KC_DOT, KC_NO,
KC_TRNS, KC_NO, KC_NO, KC_NO, MO(3), KC_NO, KC_NO, KC_NO, MO(3), KC_NO, KC_NO, KC_TRNS),

[3] = LAYOUT(KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10,
AS_TOGG, KC_F24, KC_NO, KC_NO, KC_NO, KC_NO, LSA(KC_LEFT), LSA(KC_DOWN), LSA(KC_UP), LSA(KC_RGHT),
KC_LCTL, LALT(KC_DEL),KC_NO, KC_NO, KC_NO, KC_NO, KC_VOLU, KC_NO, KC_F12, KC_F13, KC_F14, KC_NO,
KC_TRNS, KC_F23, KC_LCTL, KC_NO, KC_TRNS, KC_NO, KC_VOLD, KC_MPLY, KC_LSFT, KC_NO, KC_NO, KC_TRNS)
};

/*
Notes on keys
or, why on earth do I have keymap
lower-shift-z is CTRL-F12 - Darkroom mode in emacs
lower-x is ALT-X - emacs
layer3-a is toggle autoshift
layer3-s is F24 - i3 controls popup reminder
lower-s is ALT-F3 - multi-select in Sublime text
*/


// Determine the tapdance state to return
uint8_t cur_dance(tap_dance_state_t *state) {
if (state->count == 1) {
return SINGLE_TAP;
} else if (state->count == 2) {
return DOUBLE_TAP;
} else if (state->count == 3) {
return TRIPLE_TAP;
} else {
reset_tap_dance (state);
return 3;
}
}


// Handle the possible states for each tapdance keycode you define:

void lbrax_finished(tap_dance_state_t *state, void *user_data) {
td_state = cur_dance(state);
switch (td_state) {
case SINGLE_TAP:
register_code16(LSFT(KC_9));
break;
case DOUBLE_TAP:
register_code16(KC_LBRC);
break;
case TRIPLE_TAP:
register_code16(LSFT(KC_LBRC));
}
}

void lbrax_reset(tap_dance_state_t *state, void *user_data) {
switch (td_state) {
case SINGLE_TAP:
unregister_code16(LSFT(KC_9));
break;
case DOUBLE_TAP:
unregister_code16(KC_LBRC);
break;
case TRIPLE_TAP:
unregister_code16(LSFT(KC_LBRC));
}
}

// Handle the possible states for each tapdance keycode you define:

void rbrax_finished(tap_dance_state_t *state, void *user_data) {
td_state = cur_dance(state);
switch (td_state) {
case SINGLE_TAP:
register_code16(LSFT(KC_0));
break;
case DOUBLE_TAP:
register_code16(KC_RBRC);
break;
case TRIPLE_TAP:
register_code16(LSFT(KC_RBRC));
}
}


void rbrax_reset(tap_dance_state_t *state, void *user_data) {
switch (td_state) {
case SINGLE_TAP:
unregister_code16(LSFT(KC_0));
break;
case DOUBLE_TAP:
unregister_code16(KC_RBRC);
break;
case TRIPLE_TAP:
unregister_code16(LSFT(KC_RBRC));
}
}

void quots_finished(tap_dance_state_t *state, void *user_data) {
td_state = cur_dance(state);
switch (td_state) {
case SINGLE_TAP:
register_code16(KC_QUOT);
break;
case DOUBLE_TAP:
register_code16(KC_AT);
break;
case TRIPLE_TAP:
register_code16(KC_DQUO);
}
}

void quots_reset(tap_dance_state_t *state, void *user_data) {
switch (td_state) {
case SINGLE_TAP:
unregister_code16(KC_QUOT);
break;
case DOUBLE_TAP:
unregister_code16(KC_AT);
break;
case TRIPLE_TAP:
unregister_code16(KC_DQUO);
}
}

void tache_finished(tap_dance_state_t *state, void *user_data) {
td_state = cur_dance(state);
switch (td_state) {
case SINGLE_TAP:
register_code16(KC_NUHS);
break;
case DOUBLE_TAP:

register_code16(LSFT(KC_NUHS));
break;
case TRIPLE_TAP:
register_code16(KC_GRV);
}
}

void tache_reset(tap_dance_state_t *state, void *user_data) {
switch (td_state) {
case SINGLE_TAP:
unregister_code16(KC_NUHS);
break;
case DOUBLE_TAP:
unregister_code16(LSFT(KC_NUHS));
break;
case TRIPLE_TAP:
unregister_code16(KC_GRV);
}
}

// Define `ACTION_TAP_DANCE_FN_ADVANCED()` for each tapdance keycode, passing in `finished` and `reset` functions

tap_dance_action_t tap_dance_actions[] = {
[L_BRAX] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, lbrax_finished, lbrax_reset),
[R_BRAX] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, rbrax_finished, rbrax_reset),
[QUOTS] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, quots_finished, quots_reset),
[TACHE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, tache_finished, tache_reset)
};
35 changes: 35 additions & 0 deletions keyboards/keyboardio/atreus/keymaps/poweredbyporridge/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Keyboardio Atreus with an SLF layout from PoweredByPorridge

SLF stands for [Stiff Little Fingers](https://en.wikipedia.org/wiki/Stiff_Little_Fingers) who were a great punk band from Belfast, Northern Ireland. Stiff Little Fingers is also a good way of describing my hands, a condition which I ascribe to too many winters cycling without gloves. So, I need a keyboard and layout to cope.

I use a Keyboardio Atreus, in fact, they're so good, I use two. I tried all sorts of layouts, and finally came up with the one that suits my stiff fingers.

It has four layers:

0 - Normal - letters and punctuation.

![layer 0](https://i.imgur.com/3Z8PZtI.png)

1 - Symbols (shifted numbers), arrow keys, assorted function keys, Del and Backspace.

![layer 1](https://i.imgur.com/9rJalxV.png)

2 - Numbers, page up, page down, home, and end. Similar assorted functions.

![layer 2](https://i.imgur.com/TYY11b5.png)

3 - F1 to F14, play/pause, volume up/down, Left-shift-Alt left, right, up, down.

![layer 3](https://i.imgur.com/MuWNPTz.png)

Autoshift is important, I use it all the time.

I use tap dance (one, two, or three key presses) for:

* Braces, brackets, and curly brackets. TD(L_BRAX) and TD(R_BRAX)
* Hash (pound), tilde, and backtick. TD(TACHE)
* Single quote, double quote, and @. TD(QUOTS)

There are odd keys that are there for a particular reason:
* F24 - my [I3](https://i3wm.org/) popup to remind me of stuff I always forget.
* Alt-shift-left/right/up/down - multi-select in Sublime text.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BOOTMAGIC_ENABLE = no
MOUSEKEY_ENABLE = no
CONSOLE_ENABLE = no
COMMAND_ENABLE = no
UNICODE_ENABLE = no
AUTO_SHIFT_ENABLE = yes
TAP_DANCE_ENABLE = yes

0 comments on commit 190738c

Please sign in to comment.