aboutsummaryrefslogtreecommitdiff
path: root/users/mattly
diff options
context:
space:
mode:
authorMatthew Lyon <matthew@lyonheart.us>2020-07-21 17:08:56 -0700
committerGitHub <noreply@github.com>2020-07-21 17:08:56 -0700
commit3f96b88e73ea72474d841c1318c62b570f4aaf34 (patch)
tree9e3871d57e3f73ecfa0c71cd30cb802668c4d6ec /users/mattly
parent5e812cc4bea41688a7dd7cfc228cc5bc0cf23617 (diff)
downloadqmk_firmware-3f96b88e73ea72474d841c1318c62b570f4aaf34.tar.gz
qmk_firmware-3f96b88e73ea72474d841c1318c62b570f4aaf34.zip
mattly goes windows (#9677)
* mattly's userspace and iris * [Keymap] mattly's windows overlays * biton32->get_highest_layer * few more small tweaks
Diffstat (limited to 'users/mattly')
-rw-r--r--users/mattly/config.h3
-rw-r--r--users/mattly/mattly.c31
-rw-r--r--users/mattly/mattly.h72
-rw-r--r--users/mattly/rules.mk3
4 files changed, 64 insertions, 45 deletions
diff --git a/users/mattly/config.h b/users/mattly/config.h
index 25d379801..0f7ce4a64 100644
--- a/users/mattly/config.h
+++ b/users/mattly/config.h
@@ -1,8 +1,5 @@
1#pragma once 1#pragma once
2 2
3// Most tactile encoders have detents every 4 stages
4#define ENCODER_RESOLUTION 4
5
6#define IGNORE_MOD_TAP_INTERRUPT 3#define IGNORE_MOD_TAP_INTERRUPT
7#define PERMISSIVE_HOLD 4#define PERMISSIVE_HOLD
8#define TAPPING_TOGGLE 2 5#define TAPPING_TOGGLE 2
diff --git a/users/mattly/mattly.c b/users/mattly/mattly.c
index 1e61e0126..d097c8cd7 100644
--- a/users/mattly/mattly.c
+++ b/users/mattly/mattly.c
@@ -5,48 +5,51 @@ layer_state_t layer_state_set_keymap (layer_state_t state) {
5 return state; 5 return state;
6} 6}
7 7
8static uint16_t current_state = 0;
9
8void set_lights_default(void) { 10void set_lights_default(void) {
9 #ifdef RGBLIGHT_ENABLE 11 #ifdef RGBLIGHT_ENABLE
10 if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) { 12 if (IS_HOST_LED_ON(USB_LED_CAPS_LOCK)) {
11 rgblight_sethsv_noeeprom(HSV_CAPS); 13 rgblight_sethsv_noeeprom(HSV_CAPS);
12 } else { 14 } else {
13 rgblight_sethsv_noeeprom(HSV_DEFAULT); 15 if (current_state == _BASE_MAC) {
16 rgblight_sethsv_noeeprom(HSV_MAC);
17 } else if (current_state == _OVER_WIN) {
18 rgblight_sethsv_noeeprom(HSV_WIN);
19 }
14 } 20 }
15 #endif 21 #endif
16} 22}
17 23
18void layer_state_set_rgb(layer_state_t state) { 24void layer_state_set_rgb(layer_state_t state) {
19#ifdef RGBLIGHT_ENABLE 25#ifdef RGBLIGHT_ENABLE
20 switch (biton32(state)) { 26 switch (get_highest_layer(state)) {
21 case _QWERTY:
22 set_lights_default();
23 break;
24 case _SYMBOL: 27 case _SYMBOL:
25 rgblight_sethsv_noeeprom(HSV_SYMBOL); 28 rgblight_sethsv_noeeprom(HSV_SYMBOL);
26 break; 29 break;
27 case _NAVNUM: 30 case _NAVNUM:
31 case _NAVNUM_WIN:
28 rgblight_sethsv_noeeprom(HSV_NAVNUM); 32 rgblight_sethsv_noeeprom(HSV_NAVNUM);
29 break; 33 break;
30 case _FUNCT: 34 case _FUNCT:
35 case _FUNCT_WIN:
31 rgblight_sethsv_noeeprom(HSV_FUNCT); 36 rgblight_sethsv_noeeprom(HSV_FUNCT);
32 break; 37 break;
38 default:
39 set_lights_default();
33 } 40 }
34#endif 41#endif
35} 42}
36 43
37
38layer_state_t layer_state_set_user (layer_state_t state) { 44layer_state_t layer_state_set_user (layer_state_t state) {
39 state = update_tri_layer_state(state, _SYMBOL, _NAVNUM, _FUNCT); 45 state = update_tri_layer_state(state, _SYMBOL, _NAVNUM, _FUNCT);
46 state = update_tri_layer_state(state, _OVER_WIN, _NAVNUM, _NAVNUM_WIN);
47 state = update_tri_layer_state(state, _OVER_WIN, _FUNCT, _FUNCT_WIN);
48 current_state = get_highest_layer(state);
40 layer_state_set_rgb(state); 49 layer_state_set_rgb(state);
41 return layer_state_set_keymap (state); 50 return layer_state_set_keymap (state);
42} 51}
43 52
44void on_reset(void) {
45 #ifdef RGBLIGHT_ENABLE
46 rgblight_sethsv_noeeprom(HSV_RESET);
47 #endif
48}
49
50bool process_record_user(uint16_t keycode, keyrecord_t *record) { 53bool process_record_user(uint16_t keycode, keyrecord_t *record) {
51 switch (keycode) { 54 switch (keycode) {
52 case KC_CAPS: 55 case KC_CAPS:
@@ -55,7 +58,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
55 #endif 58 #endif
56 return true; 59 return true;
57 case RESET: 60 case RESET:
58 on_reset(); 61 #ifdef RGBLIGHT_ENABLE
62 rgblight_sethsv_noeeprom(HSV_RESET);
63 #endif
59 return true; 64 return true;
60 default: 65 default:
61 return true; 66 return true;
diff --git a/users/mattly/mattly.h b/users/mattly/mattly.h
index da09ddcdb..5f6b7c5f0 100644
--- a/users/mattly/mattly.h
+++ b/users/mattly/mattly.h
@@ -20,12 +20,18 @@
20#include "quantum.h" 20#include "quantum.h"
21 21
22enum { 22enum {
23 _QWERTY, 23 _BASE_MAC,
24 _OVER_WIN,
24 _NAVNUM, 25 _NAVNUM,
26 _NAVNUM_WIN,
25 _SYMBOL, 27 _SYMBOL,
26 _FUNCT, 28 _FUNCT,
29 _FUNCT_WIN,
27}; 30};
28 31
32// == System
33#define TOG_WIN TG(_OVER_WIN)
34
29// == Thumbs 35// == Thumbs
30// left hand 36// left hand
31#define ESC_HYP MT(MOD_HYPR, KC_ESC) 37#define ESC_HYP MT(MOD_HYPR, KC_ESC)
@@ -33,7 +39,6 @@ enum {
33#define SPC_SFT MT(MOD_LSFT, KC_SPC) 39#define SPC_SFT MT(MOD_LSFT, KC_SPC)
34#define ENT_SYM LT(_SYMBOL, KC_ENT) 40#define ENT_SYM LT(_SYMBOL, KC_ENT)
35 41
36
37// right hand 42// right hand
38#define SPC_SFT MT(MOD_LSFT, KC_SPC) 43#define SPC_SFT MT(MOD_LSFT, KC_SPC)
39#define BSP_SYM LT(_SYMBOL, KC_BSPC) 44#define BSP_SYM LT(_SYMBOL, KC_BSPC)
@@ -45,52 +50,63 @@ enum {
45 50
46// == QWERTY 51// == QWERTY
47// left hand home row 52// left hand home row
48#define A_CTRL MT(MOD_LCTL, KC_A) 53#define A_CTL MT(MOD_LCTL, KC_A)
49#define S_ALT MT(MOD_LALT, KC_S) 54#define A_GUI MT(MOD_LGUI, KC_A)
50#define D_GUI MT(MOD_LGUI, KC_D) 55#define S_ALT MT(MOD_LALT, KC_S)
51#define F_SHFT MT(MOD_LSFT, KC_F) 56#define D_GUI MT(MOD_LGUI, KC_D)
57#define D_CTL MT(MOD_LCTL, KC_D)
58#define F_SFT MT(MOD_LSFT, KC_F)
52// left hand aux 59// left hand aux
53#define W_CTRL MT(MOD_LCTL, KC_W) 60#define W_CTL MT(MOD_LCTL, KC_W)
61#define W_GUI MT(MOD_LGUI, KC_W)
54#define E_ALT MT(MOD_LALT, KC_E) 62#define E_ALT MT(MOD_LALT, KC_E)
55#define R_GUI MT(MOD_LGUI, KC_R) 63#define R_GUI MT(MOD_LGUI, KC_R)
64#define R_CTL MT(MOD_LCTL, KC_R)
56 65
57// right hand home row 66// right hand home row
58#define J_SHFT MT(MOD_RSFT, KC_J) 67#define J_SFT MT(MOD_RSFT, KC_J)
59#define K_GUI MT(MOD_RGUI, KC_K) 68#define K_GUI MT(MOD_RGUI, KC_K)
69#define K_CTL MT(MOD_RCTL, KC_K)
60#define L_ALT MT(MOD_RALT, KC_L) 70#define L_ALT MT(MOD_RALT, KC_L)
61#define MINSCTL MT(MOD_RCTL, KC_MINS) 71#define MINSCTL MT(MOD_RCTL, KC_MINS)
72#define MINSGUI MT(MOD_RGUI, KC_MINS)
62// right hand aux 73// right hand aux
63#define U_GUI MT(MOD_RGUI, KC_U) 74#define U_GUI MT(MOD_RGUI, KC_U)
75#define U_CTL MT(MOD_RCTL, KC_U)
64#define I_ALT MT(MOD_RALT, KC_I) 76#define I_ALT MT(MOD_RALT, KC_I)
65#define O_CTRL MT(MOD_RCTL, KC_O) 77#define O_CTL MT(MOD_RCTL, KC_O)
78#define O_GUI MT(MOD_RGUI, KC_O)
66 79
67// == OS X default keys 80// == OS X default keys
68// movement by word 81// movement by word
69#define BWORD LALT(KC_LEFT) 82#define M_BWORD LALT(KC_LEFT)
70#define FWORD LALT(KC_RIGHT) 83#define W_BWORD LCTL(KC_LEFT)
84#define M_FWORD LALT(KC_RIGHT)
85#define W_FWORD LCTL(KC_RIGHT)
71 86
72// gui navigation 87// gui navigation
73#define NWIN LGUI(KC_GRV) // Next Window 88#define M_NXWIN LGUI(KC_GRV) // Next Window
74#define PWIN LGUI(LSFT(KC_GRV)) // Prev Window 89#define W_NXWIN LALT(KC_TAB)
75#define NTAB LGUI(LSFT(KC_RBRC)) // Next Tab 90#define M_PVWIN LGUI(LSFT(KC_GRV)) // Prev Window
76#define PTAB LGUI(LSFT(KC_LBRC)) // Prev Tab 91#define W_PVWIN LALT(LSFT(KC_TAB))
77#define NAVBACK LGUI(KC_LBRC) // Navigate Forward 92#define M_NXTAB LGUI(LSFT(KC_RBRC)) // Next Tab
78#define NAVFWD LGUI(KC_RBRC) // Navigate Back 93#define W_NXTAB LCTL(KC_PGDN)
79 94#define M_PVTAB LGUI(LSFT(KC_LBRC)) // Prev Tab
80// my personal mappings to window manager commands 95#define W_PVTAB LCTL(KC_PGUP)
81#define XALLWIN HYPR(KC_F14) 96#define M_NAVBK LGUI(KC_LBRC) // Navigate Forward
82#define XDESKTP HYPR(KC_F15) 97#define W_NAVBK LALT(KC_LEFT)
83#define XNXTSPC HYPR(KC_F16) 98#define M_NAVFW LGUI(KC_RBRC) // Navigate Back
84#define XPRVSPC HYPR(KC_F17) 99#define W_NAVFW LALT(KC_RIGHT)
85#define XNOTIFY HYPR(KC_F18)
86 100
87// == UNDERGLOW 101// == UNDERGLOW
88#ifdef RGBLIGHT_ENABLE 102#ifdef RGBLIGHT_ENABLE
89#define HSV_CAPS 60, 255, 255 103#define HSV_CAPS 55, 255, 255
90#define HSV_DEFAULT 30, 255, 255 104#define HSV_ERR 30, 196, 196
91#define HSV_SYMBOL 18, 255, 255 105#define HSV_MAC 20, 255, 128
106#define HSV_WIN 10, 255, 128
107#define HSV_SYMBOL 235, 255, 255
92#define HSV_NAVNUM 250, 255, 255 108#define HSV_NAVNUM 250, 255, 255
93#define HSV_FUNCT 238, 255, 255 109#define HSV_FUNCT 210, 255, 255
94#define HSV_RESET 180, 255, 255 110#define HSV_RESET 180, 255, 255
95#endif 111#endif
96 112
diff --git a/users/mattly/rules.mk b/users/mattly/rules.mk
index 6803d361d..85cdcc91f 100644
--- a/users/mattly/rules.mk
+++ b/users/mattly/rules.mk
@@ -1,2 +1,3 @@
1SRC += mattly.c 1SRC += mattly.c
2MOUSEKEY_ENABLE = yes 2LTO_ENABLE = yes
3CONSOLE_ENABLE = yes