1
0
Fork 0

mattly goes windows (#9677)

* mattly's userspace and iris

* [Keymap] mattly's windows overlays

* biton32->get_highest_layer

* few more small tweaks
This commit is contained in:
Matthew Lyon 2020-07-21 17:08:56 -07:00 committed by GitHub
parent 5e812cc4be
commit 3f96b88e73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 96 additions and 65 deletions

View file

@ -5,14 +5,22 @@
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT(
[_BASE_MAC] = LAYOUT(
KC_DEL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_ESC,
KC_BSPC, KC_Q, W_CTRL, E_ALT, R_GUI, KC_T, KC_Y, U_GUI, I_ALT, O_CTRL, KC_P, KC_SCLN,
KC_CAPS, A_CTRL, S_ALT, D_GUI, F_SHFT, KC_G, KC_H, J_SHFT, K_GUI, L_ALT, MINSCTL, KC_QUOT,
KC_BSPC, KC_Q, W_CTL, E_ALT, R_GUI, KC_T, KC_Y, U_GUI, I_ALT, O_CTL, KC_P, KC_SCLN,
KC_CAPS, A_CTL, S_ALT, D_GUI, F_SFT, KC_G, KC_H, J_SFT, K_GUI, L_ALT, MINSCTL, KC_QUOT,
NAVLOCK, KC_Z, KC_X, KC_C, KC_V, KC_B, ENT_SYM, TAB_NUM, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT,
ESC_HYP, TAB_NUM, SPC_SFT, SPC_SFT, BSP_SYM, DEL_WRP
),
[_OVER_WIN] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, W_GUI, _______, R_CTL, _______, _______, U_CTL, _______, O_GUI, _______, _______,
_______, A_GUI, _______, D_CTL, _______, _______, _______, _______, K_CTL, _______, MINSGUI, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______
),
[_SYMBOL] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, KC_AMPR, KC_GRV, KC_TILD, KC_LBRC, KC_RBRC, KC_LABK, KC_RABK, KC_PLUS, KC_ASTR, XXXXXXX, _______,
@ -22,29 +30,33 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[_NAVNUM] = LAYOUT(
XNOTIFY, XXXXXXX, XPRVSPC, NWIN, XNXTSPC, XXXXXXX, XXXXXXX, KC_SLSH, KC_ASTR, KC_MINS, KC_PLUS, XXXXXXX,
XALLWIN, NAVFWD, BWORD, KC_UP, FWORD, KC_PGUP, KC_DLR, KC_P7, KC_P8, KC_P9, KC_DOT, XXXXXXX,
XDESKTP, NAVBACK, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_PERC, KC_P4, KC_P5, KC_P6, KC_EQL, XXXXXXX,
_______, PTAB, KC_HOME, PWIN, KC_END, NTAB, _______, _______, KC_P0, KC_P1, KC_P2, KC_P3, KC_COMM, _______,
XXXXXXX, XXXXXXX, XXXXXXX, M_NXWIN, XXXXXXX, XXXXXXX, XXXXXXX, KC_SLSH, KC_ASTR, KC_MINS, KC_PLUS, XXXXXXX,
XXXXXXX, M_NAVFW, M_BWORD, KC_UP, M_FWORD, KC_PGUP, KC_DLR, KC_P7, KC_P8, KC_P9, KC_DOT, XXXXXXX,
XXXXXXX, M_NAVBK, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_PERC, KC_P4, KC_P5, KC_P6, KC_EQL, XXXXXXX,
_______, M_PVTAB, KC_HOME, M_PVWIN, KC_END, M_NXTAB, _______, _______, KC_P0, KC_P1, KC_P2, KC_P3, KC_COMM, _______,
_______, _______, _______, _______, _______, KC_P0
),
[_NAVNUM_WIN] = LAYOUT(
_______, _______, _______, W_NXWIN, _______, _______, _______, _______, _______, _______, _______, _______,
_______, W_NAVFW, W_BWORD, _______, W_FWORD, _______, _______, _______, _______, _______, _______, _______,
_______, W_NAVBK, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, W_PVTAB, _______, W_PVWIN, _______, W_NXTAB, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______
),
[_FUNCT] = LAYOUT(
KC_F12, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
RESET, XALLWIN, XPRVSPC, NWIN, XNXTSPC, XDESKTP, XXXXXXX, RGB_TOG, RGB_M_P, RGB_M_B, RGB_M_K, RESET,
DEBUG, XNOTIFY, PTAB, PWIN, NTAB, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
RESET, XXXXXXX, XXXXXXX, M_NXWIN, XXXXXXX, XXXXXXX, XXXXXXX, RGB_TOG, RGB_M_P, RGB_M_B, RGB_M_K, RESET,
DEBUG, XXXXXXX, M_PVTAB, M_PVWIN, M_NXTAB, XXXXXXX, XXXXXXX, TOG_WIN, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
KC_MUTE, KC_VOLD, KC_VOLU, KC_MRWD, KC_MFFD, KC_MPLY, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
_______, _______, _______, _______, _______, _______
)
),
[_FUNCT_WIN] = LAYOUT(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, W_NXWIN, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, W_PVTAB, W_PVWIN, W_NXTAB, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______
),
};
void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
tap_code(KC_MS_WH_UP);
} else {
tap_code(KC_MS_WH_DOWN);
}
}
}

View file

@ -1,8 +1,5 @@
#pragma once
// Most tactile encoders have detents every 4 stages
#define ENCODER_RESOLUTION 4
#define IGNORE_MOD_TAP_INTERRUPT
#define PERMISSIVE_HOLD
#define TAPPING_TOGGLE 2

View file

@ -5,48 +5,51 @@ layer_state_t layer_state_set_keymap (layer_state_t state) {
return state;
}
static uint16_t current_state = 0;
void set_lights_default(void) {
#ifdef RGBLIGHT_ENABLE
if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) {
rgblight_sethsv_noeeprom(HSV_CAPS);
} else {
rgblight_sethsv_noeeprom(HSV_DEFAULT);
if (current_state == _BASE_MAC) {
rgblight_sethsv_noeeprom(HSV_MAC);
} else if (current_state == _OVER_WIN) {
rgblight_sethsv_noeeprom(HSV_WIN);
}
}
#endif
}
void layer_state_set_rgb(layer_state_t state) {
#ifdef RGBLIGHT_ENABLE
switch (biton32(state)) {
case _QWERTY:
set_lights_default();
break;
switch (get_highest_layer(state)) {
case _SYMBOL:
rgblight_sethsv_noeeprom(HSV_SYMBOL);
break;
case _NAVNUM:
case _NAVNUM_WIN:
rgblight_sethsv_noeeprom(HSV_NAVNUM);
break;
case _FUNCT:
case _FUNCT_WIN:
rgblight_sethsv_noeeprom(HSV_FUNCT);
break;
default:
set_lights_default();
}
#endif
}
layer_state_t layer_state_set_user (layer_state_t state) {
state = update_tri_layer_state(state, _SYMBOL, _NAVNUM, _FUNCT);
state = update_tri_layer_state(state, _OVER_WIN, _NAVNUM, _NAVNUM_WIN);
state = update_tri_layer_state(state, _OVER_WIN, _FUNCT, _FUNCT_WIN);
current_state = get_highest_layer(state);
layer_state_set_rgb(state);
return layer_state_set_keymap (state);
}
void on_reset(void) {
#ifdef RGBLIGHT_ENABLE
rgblight_sethsv_noeeprom(HSV_RESET);
#endif
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_CAPS:
@ -55,7 +58,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#endif
return true;
case RESET:
on_reset();
#ifdef RGBLIGHT_ENABLE
rgblight_sethsv_noeeprom(HSV_RESET);
#endif
return true;
default:
return true;

View file

@ -20,12 +20,18 @@
#include "quantum.h"
enum {
_QWERTY,
_BASE_MAC,
_OVER_WIN,
_NAVNUM,
_NAVNUM_WIN,
_SYMBOL,
_FUNCT,
_FUNCT_WIN,
};
// == System
#define TOG_WIN TG(_OVER_WIN)
// == Thumbs
// left hand
#define ESC_HYP MT(MOD_HYPR, KC_ESC)
@ -33,7 +39,6 @@ enum {
#define SPC_SFT MT(MOD_LSFT, KC_SPC)
#define ENT_SYM LT(_SYMBOL, KC_ENT)
// right hand
#define SPC_SFT MT(MOD_LSFT, KC_SPC)
#define BSP_SYM LT(_SYMBOL, KC_BSPC)
@ -45,52 +50,63 @@ enum {
// == QWERTY
// left hand home row
#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 A_CTL MT(MOD_LCTL, KC_A)
#define A_GUI MT(MOD_LGUI, KC_A)
#define S_ALT MT(MOD_LALT, KC_S)
#define D_GUI MT(MOD_LGUI, KC_D)
#define D_CTL MT(MOD_LCTL, KC_D)
#define F_SFT MT(MOD_LSFT, KC_F)
// left hand aux
#define W_CTRL MT(MOD_LCTL, KC_W)
#define W_CTL MT(MOD_LCTL, KC_W)
#define W_GUI MT(MOD_LGUI, KC_W)
#define E_ALT MT(MOD_LALT, KC_E)
#define R_GUI MT(MOD_LGUI, KC_R)
#define R_CTL MT(MOD_LCTL, KC_R)
// right hand home row
#define J_SHFT MT(MOD_RSFT, KC_J)
#define J_SFT MT(MOD_RSFT, KC_J)
#define K_GUI MT(MOD_RGUI, KC_K)
#define K_CTL MT(MOD_RCTL, KC_K)
#define L_ALT MT(MOD_RALT, KC_L)
#define MINSCTL MT(MOD_RCTL, KC_MINS)
#define MINSGUI MT(MOD_RGUI, KC_MINS)
// right hand aux
#define U_GUI MT(MOD_RGUI, KC_U)
#define U_CTL MT(MOD_RCTL, KC_U)
#define I_ALT MT(MOD_RALT, KC_I)
#define O_CTRL MT(MOD_RCTL, KC_O)
#define O_CTL MT(MOD_RCTL, KC_O)
#define O_GUI MT(MOD_RGUI, KC_O)
// == OS X default keys
// movement by word
#define BWORD LALT(KC_LEFT)
#define FWORD LALT(KC_RIGHT)
#define M_BWORD LALT(KC_LEFT)
#define W_BWORD LCTL(KC_LEFT)
#define M_FWORD LALT(KC_RIGHT)
#define W_FWORD LCTL(KC_RIGHT)
// gui navigation
#define NWIN LGUI(KC_GRV) // Next Window
#define PWIN LGUI(LSFT(KC_GRV)) // Prev Window
#define NTAB LGUI(LSFT(KC_RBRC)) // Next Tab
#define PTAB LGUI(LSFT(KC_LBRC)) // Prev Tab
#define NAVBACK LGUI(KC_LBRC) // Navigate Forward
#define NAVFWD LGUI(KC_RBRC) // Navigate Back
// my personal mappings to window manager commands
#define XALLWIN HYPR(KC_F14)
#define XDESKTP HYPR(KC_F15)
#define XNXTSPC HYPR(KC_F16)
#define XPRVSPC HYPR(KC_F17)
#define XNOTIFY HYPR(KC_F18)
#define M_NXWIN LGUI(KC_GRV) // Next Window
#define W_NXWIN LALT(KC_TAB)
#define M_PVWIN LGUI(LSFT(KC_GRV)) // Prev Window
#define W_PVWIN LALT(LSFT(KC_TAB))
#define M_NXTAB LGUI(LSFT(KC_RBRC)) // Next Tab
#define W_NXTAB LCTL(KC_PGDN)
#define M_PVTAB LGUI(LSFT(KC_LBRC)) // Prev Tab
#define W_PVTAB LCTL(KC_PGUP)
#define M_NAVBK LGUI(KC_LBRC) // Navigate Forward
#define W_NAVBK LALT(KC_LEFT)
#define M_NAVFW LGUI(KC_RBRC) // Navigate Back
#define W_NAVFW LALT(KC_RIGHT)
// == UNDERGLOW
#ifdef RGBLIGHT_ENABLE
#define HSV_CAPS 60, 255, 255
#define HSV_DEFAULT 30, 255, 255
#define HSV_SYMBOL 18, 255, 255
#define HSV_CAPS 55, 255, 255
#define HSV_ERR 30, 196, 196
#define HSV_MAC 20, 255, 128
#define HSV_WIN 10, 255, 128
#define HSV_SYMBOL 235, 255, 255
#define HSV_NAVNUM 250, 255, 255
#define HSV_FUNCT 238, 255, 255
#define HSV_FUNCT 210, 255, 255
#define HSV_RESET 180, 255, 255
#endif

View file

@ -1,2 +1,3 @@
SRC += mattly.c
MOUSEKEY_ENABLE = yes
LTO_ENABLE = yes
CONSOLE_ENABLE = yes