2d1290a12c
This allows leader sequences to "time out" rather than requiring an Enter keypress to end. This also rolls back some unnecessary changes from #72 to the matrix scanner for performance reasons. In theory we can use this in the future for Tap Dance support (#40) Resolves #1 Resolves #37
91 lines
3.8 KiB
Python
91 lines
3.8 KiB
Python
from kmk.boards.klarank import Firmware
|
|
from kmk.consts import LeaderMode, UnicodeModes
|
|
from kmk.keycodes import KC
|
|
from kmk.keycodes import generate_leader_dictionary_seq as glds
|
|
from kmk.macros.simple import send_string
|
|
from kmk.macros.unicode import compile_unicode_string_sequences as cuss
|
|
|
|
keyboard = Firmware()
|
|
|
|
keyboard.debug_enabled = True
|
|
keyboard.unicode_mode = UnicodeModes.LINUX
|
|
|
|
_______ = KC.TRNS
|
|
xxxxxxx = KC.NO
|
|
|
|
emoticons = cuss({
|
|
# Emojis
|
|
'BEER': r'🍺',
|
|
'BEER_TOAST': r'🍻',
|
|
'FACE_CUTE_SMILE': r'😊',
|
|
'FACE_HEART_EYES': r'😍',
|
|
'FACE_JOY': r'😂',
|
|
'FACE_SWEAT_SMILE': r'😅',
|
|
'FACE_THINKING': r'🤔',
|
|
'FIRE': r'🔥',
|
|
'FLAG_CA': r'🇨🇦',
|
|
'FLAG_US': r'🇺🇸',
|
|
'HAND_CLAP': r'👏',
|
|
'HAND_HORNS': r'🤘',
|
|
'HAND_OK': r'👌',
|
|
'HAND_THUMB_DOWN': r'👎',
|
|
'HAND_THUMB_UP': r'👍',
|
|
'HAND_WAVE': r'👋',
|
|
'HEART': r'❤️',
|
|
'MAPLE_LEAF': r'🍁',
|
|
'POOP': r'💩',
|
|
'TADA': r'🎉',
|
|
|
|
# Emoticons, but fancier
|
|
'ANGRY_TABLE_FLIP': r'(ノಠ痊ಠ)ノ彡┻━┻',
|
|
'CELEBRATORY_GLITTER': r'+。:.゚ヽ(´∀。)ノ゚.:。+゚゚+。:.゚ヽ(*´∀)ノ゚.:。+゚',
|
|
'SHRUGGIE': r'¯\_(ツ)_/¯',
|
|
'TABLE_FLIP': r'(╯°□°)╯︵ ┻━┻',
|
|
})
|
|
|
|
WPM = send_string("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Bibendum arcu vitae elementum curabitur vitae nunc sed. Facilisis sed odio morbi quis.")
|
|
|
|
keyboard.leader_mode = LeaderMode.TIMEOUT
|
|
keyboard.leader_dictionary = {
|
|
glds('hello'): send_string('hello world from kmk macros'),
|
|
glds('wpm'): WPM,
|
|
glds('atf'): emoticons.ANGRY_TABLE_FLIP,
|
|
glds('tf'): emoticons.TABLE_FLIP,
|
|
glds('fca'): emoticons.FLAG_CA,
|
|
glds('fus'): emoticons.FLAG_US,
|
|
glds('cel'): emoticons.CELEBRATORY_GLITTER,
|
|
}
|
|
|
|
keyboard.keymap = [
|
|
[
|
|
[KC.GESC, KC.QUOT, KC.COMM, KC.DOT, KC.P, KC.Y, KC.F, KC.G, KC.C, KC.R, KC.L, KC.BSPC],
|
|
[KC.TAB, KC.A, KC.O, KC.E, KC.U, KC.I, KC.D, KC.H, KC.T, KC.N, KC.S, KC.ENT],
|
|
[KC.LGUI, KC.SCLN, KC.Q, KC.J, KC.K, KC.X, KC.B, KC.M, KC.W, KC.V, KC.Z, KC.LALT],
|
|
[KC.LCTL, KC.LEAD, KC.LSHIFT(KC.LGUI), KC.MO(2), KC.MO(3), KC.LSFT, KC.SPC, KC.MO(1), KC.LEFT, KC.DOWN, KC.UP, KC.RGHT],
|
|
],
|
|
|
|
[
|
|
[KC.GESC, xxxxxxx, xxxxxxx, KC.F10, KC.F11, KC.F12, xxxxxxx, KC.PSLS, KC.N7, KC.N8, KC.N9, KC.BSPC],
|
|
[KC.TAB, xxxxxxx, xxxxxxx, KC.F7, KC.F8, KC.F9, xxxxxxx, KC.PAST, KC.N4, KC.N5, KC.N6, _______],
|
|
[KC.LGUI, xxxxxxx, xxxxxxx, KC.F4, KC.F5, KC.F6, xxxxxxx, KC.PMNS, KC.N1, KC.N2, KC.N3, _______],
|
|
[KC.LCTL, xxxxxxx, _______, KC.F1, KC.F2, KC.F3, KC.SPC, _______, KC.N0, KC.DOT, xxxxxxx, KC.EQL],
|
|
],
|
|
|
|
[
|
|
[KC.GESC, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, KC.BSLS, KC.LBRC, KC.RBRC, KC.DEL],
|
|
[KC.TAB, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, KC.MINS],
|
|
[KC.LGUI, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, KC.LBRC, xxxxxxx, xxxxxxx, KC.INS],
|
|
[KC.LCTL, xxxxxxx, _______, _______, xxxxxxx, _______, xxxxxxx, xxxxxxx, KC.HOME, KC.PGDN, KC.PGUP, KC.END],
|
|
],
|
|
|
|
[
|
|
[KC.GRV, KC.EXLM, KC.AT, KC.HASH, KC.DLR, KC.PERC, KC.CIRC, KC.AMPR, KC.ASTR, KC.LPRN, KC.RPRN, KC.SLSH],
|
|
[KC.TAB, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, KC.MINS],
|
|
[KC.LGUI, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx],
|
|
[KC.LCTL, KC.DBG, xxxxxxx, xxxxxxx, _______, _______, xxxxxxx, xxxxxxx, KC.MUTE, KC.VOLD, KC.VOLU, xxxxxxx],
|
|
],
|
|
]
|
|
|
|
if __name__ == '__main__':
|
|
keyboard.go()
|