fixup combos, store references to more complex key codes for re-use with combos
This commit is contained in:
parent
1bb827e8dc
commit
c13bcb8f56
97
ardux/kb.py
97
ardux/kb.py
|
@ -6,14 +6,23 @@ from kmk.quickpin.pro_micro.kb2040 import pinout as pins
|
||||||
from kmk.kmk_keyboard import KMKKeyboard
|
from kmk.kmk_keyboard import KMKKeyboard
|
||||||
from kmk.scanners.keypad import KeysScanner
|
from kmk.scanners.keypad import KeysScanner
|
||||||
|
|
||||||
|
from kmk.keys import KC
|
||||||
|
from ardux.chord import ArduxChord
|
||||||
|
|
||||||
|
from kmk.modules.holdtap import HoldTap
|
||||||
from kmk.modules.layers import Layers
|
from kmk.modules.layers import Layers
|
||||||
from kmk.modules.combos import Combos, Chord
|
from kmk.modules.combos import Combos, Chord
|
||||||
from kmk.modules.mouse_keys import MouseKeys
|
from kmk.modules.mouse_keys import MouseKeys
|
||||||
|
|
||||||
from kmk.extensions.media_keys import MediaKeys
|
from kmk.extensions.media_keys import MediaKeys
|
||||||
|
|
||||||
from ardux.chord import ArduxChord
|
# constants
|
||||||
from kmk.keys import KC
|
LAYER_ID_BASE = 0
|
||||||
|
LAYER_ID_PARENS = 1
|
||||||
|
LAYER_ID_NUMBERS = 2
|
||||||
|
LAYER_ID_NAVIGATION = 3
|
||||||
|
LAYER_ID_SYMBOLS = 4
|
||||||
|
LAYER_ID_CUSTOM = 5
|
||||||
|
LAYER_ID_MOUSE = 6
|
||||||
|
|
||||||
class ArduxKeyboard(KMKKeyboard):
|
class ArduxKeyboard(KMKKeyboard):
|
||||||
coord_mapping = [
|
coord_mapping = [
|
||||||
|
@ -21,10 +30,55 @@ class ArduxKeyboard(KMKKeyboard):
|
||||||
4, 5, 6, 7,
|
4, 5, 6, 7,
|
||||||
]
|
]
|
||||||
|
|
||||||
keymap = [
|
keymap = []
|
||||||
|
|
||||||
|
# Init / constructor / setup
|
||||||
|
def __init__(self):
|
||||||
|
# Enable debugging if appropriate
|
||||||
|
if os.getenv('ARDUX_KMK_DEBUGGING'):
|
||||||
|
self.debug_enabled = True
|
||||||
|
|
||||||
|
# setup modules/extensions arrays
|
||||||
|
self.modules = []
|
||||||
|
self.extensions = []
|
||||||
|
|
||||||
|
# Direct wire & matrix setup
|
||||||
|
self.matrix = KeysScanner([pins[16], pins[17], pins[18], pins[19], pins[12], pins[13], pins[14], pins[15]])
|
||||||
|
|
||||||
|
# HoldTap
|
||||||
|
self.holdtap_module = HoldTap()
|
||||||
|
self.holdtap_module.tap_time = 175
|
||||||
|
self.modules.append(self.holdtap_module)
|
||||||
|
|
||||||
|
# Layers
|
||||||
|
self.modules.append(Layers())
|
||||||
|
|
||||||
|
# Media Keys
|
||||||
|
self.extensions.append(MediaKeys())
|
||||||
|
|
||||||
|
# Mouse Keys
|
||||||
|
self.modules.append(MouseKeys())
|
||||||
|
|
||||||
|
# Combos
|
||||||
|
self.combo_module = Combos()
|
||||||
|
self.modules.append(self.combo_module)
|
||||||
|
|
||||||
|
# Setup kemap as last step
|
||||||
|
self.setup_keymap()
|
||||||
|
|
||||||
|
# Setup combos
|
||||||
|
self.setup_combos()
|
||||||
|
|
||||||
|
# Define keymap
|
||||||
|
def setup_keymap(self):
|
||||||
|
self.base_s_numbers = KC.LT(LAYER_ID_NUMBERS, KC.S, prefer_hold=False)
|
||||||
|
self.base_a_parens = KC.LT(LAYER_ID_PARENS, KC.A, prefer_hold=False)
|
||||||
|
self.base_o_custom = KC.LT(LAYER_ID_CUSTOM, KC.O, prefer_hold=False)
|
||||||
|
self.base_e_symbols = KC.LT(LAYER_ID_SYMBOLS, KC.E, prefer_hold=False)
|
||||||
|
self.keymap = [
|
||||||
# std - left - base
|
# std - left - base
|
||||||
[KC.S, KC.T, KC.R, KC.A,
|
[self.base_s_numbers, KC.T, KC.R, self.base_a_parens,
|
||||||
KC.O, KC.I, KC.Y, KC.E],
|
self.base_o_custom, KC.I, KC.Y, self.base_e_symbols],
|
||||||
# std - left - parenthesis
|
# std - left - parenthesis
|
||||||
[KC.RIGHT_CURLY_BRACE, KC.LEFT_PAREN, KC.RIGHT_PAREN, KC.TRANSPARENT,
|
[KC.RIGHT_CURLY_BRACE, KC.LEFT_PAREN, KC.RIGHT_PAREN, KC.TRANSPARENT,
|
||||||
KC.LEFT_CURLY_BRACE, KC.LBRACKET, KC.RBRACKET, KC.NO],
|
KC.LEFT_CURLY_BRACE, KC.LBRACKET, KC.RBRACKET, KC.NO],
|
||||||
|
@ -45,39 +99,12 @@ class ArduxKeyboard(KMKKeyboard):
|
||||||
KC.MW_DOWN, KC.MS_LEFT, KC.MS_DOWN, KC.MS_RIGHT]
|
KC.MW_DOWN, KC.MS_LEFT, KC.MS_DOWN, KC.MS_RIGHT]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Init / constructor / setup
|
|
||||||
def __init__(self):
|
|
||||||
# Enable debugging if appropriate
|
|
||||||
if os.getenv('ARDUX_KMK_DEBUGGING'):
|
|
||||||
self.debug_enabled = True
|
|
||||||
|
|
||||||
# setup modules/extensions arrays
|
|
||||||
self.modules = []
|
|
||||||
self.extensions = []
|
|
||||||
|
|
||||||
# Direct wire & matrix setup
|
|
||||||
self.matrix = KeysScanner([pins[16], pins[17], pins[18], pins[19], pins[12], pins[13], pins[14], pins[15]])
|
|
||||||
|
|
||||||
# Layers
|
|
||||||
self.modules.append(Layers())
|
|
||||||
|
|
||||||
# Media Keys
|
|
||||||
self.extensions.append(MediaKeys())
|
|
||||||
|
|
||||||
# Mouse Keys
|
|
||||||
self.modules.append(MouseKeys())
|
|
||||||
|
|
||||||
# Combos
|
|
||||||
self.combo_module = Combos()
|
|
||||||
self.modules.append(self.combo_module)
|
|
||||||
self.setup_combos()
|
|
||||||
|
|
||||||
# Define combos for ardux
|
# Define combos for ardux
|
||||||
def setup_combos(self):
|
def setup_combos(self):
|
||||||
self.combo_module.combos = []
|
self.combo_module.combos = []
|
||||||
|
|
||||||
combo_enter = ArduxChord((KC.A, KC.E), KC.ENTER, ardux_keyboard=[self], layers=[0])
|
combo_enter = ArduxChord((self.base_a_parens, self.base_e_symbols), KC.ENTER, ardux_keyboard=[self], layers=[0])
|
||||||
self.combo_module.combos.append(combo_enter)
|
self.combo_module.combos.append(combo_enter)
|
||||||
|
|
||||||
combo_space = ArduxChord((KC.O, KC.I, KC.Y, KC.E), KC.SPACE, ardux_keyboard=[self], layers=[1])
|
combo_space = ArduxChord((self.base_o_custom, KC.I, KC.Y, self.base_e_symbols), KC.SPACE, ardux_keyboard=[self], layers=[1])
|
||||||
self.combo_module.combos.append(combo_space)
|
self.combo_module.combos.append(combo_space)
|
||||||
|
|
Loading…
Reference in a new issue