Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The slf-atreus layout for the Keyboardio Atreus #20903

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions keyboards/keyboardio/atreus/keymaps/slf-atreus/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* 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
// 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 250 and I can't tap dance brackets without a run up.
#define TAPPING_TERM 210

#define TAPPING_TERM_PER_KEY

// Prevent normal rollover on alphas from accidentally triggering mods.
#define IGNORE_MOD_TAP_INTERRUPT
PoweredByPorridge marked this conversation as resolved.
Show resolved Hide resolved

// Enable rapid switch from tap to hold, disables double tap hold auto-repeat.
#define TAPPING_FORCE_HOLD
PoweredByPorridge marked this conversation as resolved.
Show resolved Hide resolved

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

#define COMBO_COUNT 2

// the make command:
// From ~/qmk_firmware
// make keyboardio/atreus:slf-atreus:flash

266 changes: 266 additions & 0 deletions keyboards/keyboardio/atreus/keymaps/slf-atreus/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
/* 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

// Left-hand home row mods
// #define GUI_A LGUI_T(KC_A)
// #define ALT_S LALT_T(KC_S)
// #define SFT_D LSFT_T(KC_D)
// #define CTL_F LCTL_T(KC_F)

// Right-hand home row mods
// #define CTL_J RCTL_T(KC_J)
// #define SFT_K RSFT_T(KC_K)
// #define ALT_L LALT_T(KC_L)
// #define GUI_SCLN RGUI_T(KC_SCLN)



// 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)
};


// Two combos
const uint16_t PROGMEM CtlAlt_combo_L[] = {LCTL_T(KC_ESC), KC_RCTL, COMBO_END};
const uint16_t PROGMEM CtlAlt_combo_R[] = {KC_RCTL, LCTL_T(KC_TAB), COMBO_END};
combo_t key_combos[COMBO_COUNT] = {
COMBO(CtlAlt_combo_L, KC_LALT), // Alt using tab/Ctl and key to left
COMBO(CtlAlt_combo_R, KC_LALT), // Alt using Esc/Ctl and key to right
};


/*
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_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
register_code16(KC_9);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do this, instead:

Suggested change
register_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
register_code16(KC_9);
register_code16(LSFT(KC_9));

break;
case DOUBLE_TAP:
register_code16(KC_LBRC);
break;
case TRIPLE_TAP:
register_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
register_code16(KC_LBRC);
}
}

void lbrax_reset(tap_dance_state_t *state, void *user_data) {
switch (td_state) {
case SINGLE_TAP:
unregister_code16(KC_9);
unregister_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
break;
case DOUBLE_TAP:
unregister_code16(KC_LBRC);
break;
case TRIPLE_TAP:
unregister_code16(KC_LBRC);
unregister_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
}
}

// 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_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
register_code16(KC_0);
break;
case DOUBLE_TAP:
register_code16(KC_RBRC);
break;
case TRIPLE_TAP: // Allow nesting of 2 parens `((` within tapping term
register_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
register_code16(KC_RBRC);
}
}


void rbrax_reset(tap_dance_state_t *state, void *user_data) {
switch (td_state) {
case SINGLE_TAP:
unregister_code16(KC_0);
unregister_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
break;
case DOUBLE_TAP:
unregister_code16(KC_RBRC);
break;
case TRIPLE_TAP:
unregister_code16(KC_RBRC);
unregister_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
}
}

void quots_finished(tap_dance_state_t *state, void *user_data) {
td_state = cur_dance(state);
switch (td_state) {
case SINGLE_TAP:
// register_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
register_code16(KC_QUOT);
break;
case DOUBLE_TAP:
register_code16(KC_AT);
break;
case TRIPLE_TAP: // Allow nesting of 2 parens `((` within tapping term
// register_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
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);
// unregister_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
break;
case DOUBLE_TAP:
unregister_code16(KC_AT);
break;
case TRIPLE_TAP:
unregister_code16(KC_DQUO);
// unregister_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
}
}

void tache_finished(tap_dance_state_t *state, void *user_data) {
td_state = cur_dance(state);
switch (td_state) {
case SINGLE_TAP:
// register_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
register_code16(KC_NUHS);
break;
case DOUBLE_TAP:
register_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
register_code16(KC_NUHS);
break;
case TRIPLE_TAP: // Allow nesting of 2 parens `((` within tapping term
// register_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
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);
// unregister_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
break;
case DOUBLE_TAP:
unregister_code16(KC_NUHS);
unregister_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
break;
case TRIPLE_TAP:
unregister_code16(KC_GRV);
// unregister_mods(MOD_BIT(KC_LSFT)); // For a layer-tap key, use `layer_on(_MY_LAYER)` here
}
}


// 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/slf-atreus/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Keyboardio Atreus with an SLF layout

[Stiff Little Fingers](https://en.wikipedia.org/wiki/Stiff_Little_Fingers) 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 years cycling without gloves in cold weather. 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 little fingers; the slf-atreus.

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.
33 changes: 33 additions & 0 deletions keyboards/keyboardio/atreus/keymaps/slf-atreus/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# MCU name
MCU = atmega32u4

PoweredByPorridge marked this conversation as resolved.
Show resolved Hide resolved
# Bootloader selection
# BOOTLOADER = qmk-dfu # Elite C
BOOTLOADER = caterina

# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # was = lite # Virtual DIP switch configuration
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control

CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration

# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE

SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
NKRO_ENABLE = yes # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = no # Audio output

UNICODE_ENABLE = no # Unicode

AUTO_SHIFT_ENABLE = yes # Auto shift
TAP_DANCE_ENABLE = yes # tap dance. One tap one code, two taps another code, three taps, and so on.

COMBO_ENABLE = yes # Combos - q+w=Esc
Loading