Skip to content

Instantly share code, notes, and snippets.

@JoshStrobl
Last active June 15, 2022 03:50
Show Gist options
  • Save JoshStrobl/b6ba5bda488b3d30f59f54e666fbe078 to your computer and use it in GitHub Desktop.
Save JoshStrobl/b6ba5bda488b3d30f59f54e666fbe078 to your computer and use it in GitHub Desktop.
my qmk keymap
/*
Copyright 2019 @foostan
Copyright 2020 Drashna Jaelre <@drashna>
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 "keymap_finnish.h"
#include "keymap_nordic.h"
#include <stdio.h>
enum kill_the_dead_keys {
QMKBEST = SAFE_RANGE,
X_FI_TILD,
X_FI_GRV,
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_split_3x6_3(
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, FI_QUOT, KC_BSPC,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LCTL, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, KC_SLSH,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LSFT, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, FI_COMM, FI_DOT, KC_ESC, KC_RCTL,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LALT, TT(1), KC_SPC, KC_ENT, TT(2), KC_LGUI
//`--------------------------' `--------------------------'
),
[1] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_TAB, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LCTL, KC_MPRV, KC_MPLY, KC_MNXT, FI_LPRN, FI_LCBR, FI_PLUS, FI_EQL, FI_PIPE, XXXXXXX, KC_UP, XXXXXXX,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LSFT, KC_VOLD, KC_MUTE, KC_VOLU, FI_DQUO, FI_LBRC, FI_LABK, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RIGHT,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LALT, KC_TRNS, KC_SPC, KC_ENT, KC_TRNS, KC_LGUI
//`--------------------------' `--------------------------'
),
[2] = LAYOUT_split_3x6_3(
//,-----------------------------------------------------. ,-----------------------------------------------------.
KC_TAB, KC_EXLM, FI_AT, FI_HASH, FI_DLR, KC_PERC, FI_AMPR, FI_SLSH, X_FI_TILD, FI_EQL, FI_QUES, KC_DELETE,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LCTL, FI_ADIA, XXXXXXX, FI_CIRC, NO_EURO, KC_PSCR, FI_PLUS, X_FI_GRV, FI_PIPE, XXXXXXX, FI_ODIA, XXXXXXX,
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------|
KC_LSFT, KC_F2, KC_F5, KC_F12, C(S(KC_I)), C(S(KC_P)), KC_HOME, KC_END, KC_PGUP, KC_PGDN, XXXXXXX, XXXXXXX,
//|--------+--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
KC_LALT, KC_TRNS, KC_SPC, KC_ENT, KC_TRNS, KC_LGUI
//`--------------------------' `--------------------------'
)
};
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (!is_keyboard_master()) {
return OLED_ROTATION_180; // flips the display 180 degrees if offhand
}
return rotation;
}
#define L_BASE 0
#define L_LOWER 2
#define L_RAISE 4
#define L_ADJUST 8
void oled_render_layer_state(void) {
oled_write_P(PSTR("Layer: "), false);
switch (layer_state) {
case L_BASE:
oled_write_ln_P(PSTR("Layer 0"), false);
break;
case L_LOWER:
oled_write_ln_P(PSTR("Layer 1"), false);
break;
case L_RAISE:
oled_write_ln_P(PSTR("Layer 2"), false);
break;
}
}
char keylog_str[24] = {};
void oled_render_keylog(void) {
oled_write(keylog_str, false);
}
void render_bootmagic_status(bool status) {
/* Show Ctrl-Gui Swap options */
static const char PROGMEM logo[][2][3] = {
{{0x97, 0x98, 0}, {0xb7, 0xb8, 0}},
{{0x95, 0x96, 0}, {0xb5, 0xb6, 0}},
};
if (status) {
oled_write_ln_P(logo[0][0], false);
oled_write_ln_P(logo[0][1], false);
} else {
oled_write_ln_P(logo[1][0], false);
oled_write_ln_P(logo[1][1], false);
}
}
bool oled_task_user(void) {
oled_render_layer_state();
oled_render_keylog();
return false;
}
bool get_custom_auto_shifted_key(uint16_t keycode, keyrecord_t *record) {
switch(keycode) {
case FI_LPRN:
return true;
case FI_LCBR:
return true;
case FI_DQUO:
return true;
case FI_LBRC:
return true;
case FI_LABK:
return true;
case FI_SLSH:
return true;
default:
return false;
}
}
void autoshift_press_user(uint16_t keycode, bool shifted, keyrecord_t *record) {
switch(keycode) {
case FI_LPRN:
register_code16((!shifted) ? FI_LPRN : FI_RPRN);
break;
case FI_LCBR:
register_code16((!shifted) ? FI_LCBR : FI_RCBR);
break;
case FI_DQUO:
register_code16((!shifted) ? FI_DQUO : FI_QUOT);
break;
case FI_LBRC:
register_code16((!shifted) ? FI_LBRC : FI_RBRC);
break;
case FI_LABK:
register_code16((!shifted) ? FI_LABK : FI_RABK);
break;
case FI_SLSH:
register_code16((!shifted) ? FI_SLSH : FI_BSLS);
break;
default:
if (shifted) {
add_weak_mods(MOD_BIT(KC_LSFT));
}
register_code16((IS_RETRO(keycode)) ? keycode & 0xFF : keycode);
}
}
void autoshift_release_user(uint16_t keycode, bool shifted, keyrecord_t *record) {
switch(keycode) {
case FI_LPRN:
unregister_code16((!shifted) ? FI_LPRN : FI_RPRN);
break;
case FI_LCBR:
unregister_code16((!shifted) ? FI_LCBR : FI_RCBR);
break;
case FI_DQUO:
unregister_code16((!shifted) ? FI_DQUO : FI_QUOT);
break;
case FI_LBRC:
unregister_code16((!shifted) ? FI_LBRC : FI_RBRC);
break;
case FI_LABK:
unregister_code16((!shifted) ? FI_LABK : FI_RABK);
break;
case FI_SLSH:
unregister_code16((!shifted) ? FI_SLSH : FI_BSLS);
break;
default:
// & 0xFF gets the Tap key for Tap Holds, required when using Retro Shift
// The IS_RETRO check isn't really necessary here, always using
// keycode & 0xFF would be fine.
unregister_code16((IS_RETRO(keycode)) ? keycode & 0xFF : keycode);
}
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch(keycode) {
case X_FI_GRV:
register_code(KC_LSFT);
tap_code(FI_ACUT);
tap_code(KC_SPC);
unregister_code(KC_LSFT);
break;
case X_FI_TILD:
register_code(KC_ALGR);
tap_code(FI_DIAE);
unregister_code(KC_ALGR);
tap_code(KC_SPC);
break;
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment