mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 03:19:24 +00:00
Compare commits
4 Commits
30a34917a5
...
7227288f50
Author | SHA1 | Date | |
---|---|---|---|
|
7227288f50 | ||
|
9bea332a21 | ||
|
8cbcdcac62 | ||
|
81564e3c65 |
74
keyboards/smartkit/macro8/info.json
Normal file
74
keyboards/smartkit/macro8/info.json
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
"keyboard_name": "Macro8",
|
||||
"manufacturer": "SmartKit",
|
||||
"url": "smartkit.si",
|
||||
"maintainer": "qmk",
|
||||
"usb": {
|
||||
"vid": "0x6000",
|
||||
"pid": "0x6060",
|
||||
"device_version": "0.0.3"
|
||||
},
|
||||
"matrix_pins": {
|
||||
"cols": ["D1", "D0", "D4", "C6", "D7", "E6", "B4", "B5"],
|
||||
"rows": ["B3" ]
|
||||
},
|
||||
"diode_direction": "COL2ROW",
|
||||
"encoder": {
|
||||
"rotary": [
|
||||
{"pin_a": "F5", "pin_b": "F6", "resolution": 1}
|
||||
]
|
||||
},
|
||||
"features": {
|
||||
"bootmagic": true,
|
||||
"command": false,
|
||||
"console": false,
|
||||
"extrakey": true,
|
||||
"key_lock": true,
|
||||
"mousekey": true,
|
||||
"nkro": true,
|
||||
"rgblight": true
|
||||
},
|
||||
"bootmagic": {
|
||||
"matrix": [0, 7]
|
||||
},
|
||||
"dynamic_keymap": {
|
||||
"layer_count": 3
|
||||
},
|
||||
"rgblight": {
|
||||
"led_count": 8,
|
||||
"animations": {
|
||||
"breathing": true,
|
||||
"rainbow_mood": true,
|
||||
"rainbow_swirl": true,
|
||||
"snake": true,
|
||||
"knight": true,
|
||||
"christmas": false,
|
||||
"static_gradient": true,
|
||||
"rgb_test": true,
|
||||
"alternating": false,
|
||||
"twinkle": true
|
||||
}
|
||||
},
|
||||
"ws2812": {
|
||||
"pin": "B6"
|
||||
},
|
||||
"processor": "atmega32u4",
|
||||
"bootloader": "atmel-dfu",
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{"matrix": [0, 0], "x": 0, "y": 0},
|
||||
{"matrix": [0, 1], "x": 1, "y": 0},
|
||||
{"matrix": [0, 2], "x": 2, "y": 0},
|
||||
{"matrix": [0, 3], "x": 3, "y": 0},
|
||||
|
||||
{"matrix": [0, 4], "x": 0, "y": 1},
|
||||
{"matrix": [0, 5], "x": 1, "y": 1},
|
||||
{"matrix": [0, 6], "x": 2, "y": 1},
|
||||
{"matrix": [0, 7], "x": 3, "y": 1}
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
26
keyboards/smartkit/macro8/keymaps/default/keymap.c
Normal file
26
keyboards/smartkit/macro8/keymaps/default/keymap.c
Normal file
@ -0,0 +1,26 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT(
|
||||
KC_0, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8),
|
||||
|
||||
[1] = LAYOUT(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||
|
||||
[2] = LAYOUT(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef ENCODER_MAP_ENABLE
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
|
||||
[1] = { ENCODER_CCW_CW(_______, _______) },
|
||||
[2] = { ENCODER_CCW_CW(_______, _______) }
|
||||
};
|
||||
#endif
|
||||
|
1
keyboards/smartkit/macro8/keymaps/default/rules.mk
Normal file
1
keyboards/smartkit/macro8/keymaps/default/rules.mk
Normal file
@ -0,0 +1 @@
|
||||
ENCODER_MAP_ENABLE = yes
|
26
keyboards/smartkit/macro8/keymaps/via/keymap.c
Normal file
26
keyboards/smartkit/macro8/keymaps/via/keymap.c
Normal file
@ -0,0 +1,26 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT(
|
||||
KC_0, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8),
|
||||
|
||||
[1] = LAYOUT(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||
|
||||
[2] = LAYOUT(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef ENCODER_MAP_ENABLE
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
|
||||
[1] = { ENCODER_CCW_CW(_______, _______) },
|
||||
[2] = { ENCODER_CCW_CW(_______, _______) }
|
||||
};
|
||||
#endif
|
||||
|
2
keyboards/smartkit/macro8/keymaps/via/rules.mk
Normal file
2
keyboards/smartkit/macro8/keymaps/via/rules.mk
Normal file
@ -0,0 +1,2 @@
|
||||
ENCODER_MAP_ENABLE = yes
|
||||
VIA_ENABLE = yes
|
2
keyboards/smartkit/macro8/rules.mk
Normal file
2
keyboards/smartkit/macro8/rules.mk
Normal file
@ -0,0 +1,2 @@
|
||||
ENCODER_ENABLE = yes
|
||||
DYNAMIC_MACRO_ENABLE = yes
|
70
keyboards/smartkit/macro8_line/info.json
Normal file
70
keyboards/smartkit/macro8_line/info.json
Normal file
@ -0,0 +1,70 @@
|
||||
{
|
||||
"keyboard_name": "Macro8 Line",
|
||||
"manufacturer": "SmartKit",
|
||||
"url": "smartkit.si",
|
||||
"maintainer": "qmk",
|
||||
"usb": {
|
||||
"vid": "0x6000",
|
||||
"pid": "0x6062",
|
||||
"device_version": "0.0.2"
|
||||
},
|
||||
"matrix_pins": {
|
||||
"cols": ["D1", "D0", "D4", "C6", "D7", "E6", "B4", "B5"],
|
||||
"rows": ["B3" ]
|
||||
},
|
||||
"diode_direction": "COL2ROW",
|
||||
|
||||
"features": {
|
||||
"bootmagic": true,
|
||||
"command": false,
|
||||
"console": false,
|
||||
"extrakey": true,
|
||||
"key_lock": true,
|
||||
"mousekey": true,
|
||||
"nkro": true,
|
||||
"rgblight": true
|
||||
},
|
||||
"bootmagic": {
|
||||
"matrix": [0, 7]
|
||||
},
|
||||
"dynamic_keymap": {
|
||||
"layer_count": 4
|
||||
},
|
||||
"rgblight": {
|
||||
"led_count": 8,
|
||||
"animations": {
|
||||
"breathing": true,
|
||||
"rainbow_mood": true,
|
||||
"rainbow_swirl": true,
|
||||
"snake": true,
|
||||
"knight": true,
|
||||
"christmas": false,
|
||||
"static_gradient": true,
|
||||
"rgb_test": true,
|
||||
"alternating": false,
|
||||
"twinkle": true
|
||||
}
|
||||
},
|
||||
"ws2812": {
|
||||
"pin": "B6"
|
||||
},
|
||||
"processor": "atmega32u4",
|
||||
"bootloader": "atmel-dfu",
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{"matrix": [0, 0], "x": 0, "y": 0},
|
||||
{"matrix": [0, 1], "x": 1, "y": 0},
|
||||
{"matrix": [0, 2], "x": 2, "y": 0},
|
||||
{"matrix": [0, 3], "x": 3, "y": 0},
|
||||
|
||||
{"matrix": [0, 4], "x": 4, "y": 0},
|
||||
{"matrix": [0, 5], "x": 5, "y": 0},
|
||||
{"matrix": [0, 6], "x": 6, "y": 0},
|
||||
{"matrix": [0, 7], "x": 7, "y": 0}
|
||||
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
23
keyboards/smartkit/macro8_line/keymaps/default/keymap.c
Normal file
23
keyboards/smartkit/macro8_line/keymaps/default/keymap.c
Normal file
@ -0,0 +1,23 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT(
|
||||
KC_0, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8),
|
||||
|
||||
[1] = LAYOUT(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||
|
||||
[2] = LAYOUT(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||
|
||||
[3] = LAYOUT(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
23
keyboards/smartkit/macro8_line/keymaps/via/keymap.c
Normal file
23
keyboards/smartkit/macro8_line/keymaps/via/keymap.c
Normal file
@ -0,0 +1,23 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT(
|
||||
KC_0, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8),
|
||||
|
||||
[1] = LAYOUT(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||
|
||||
[2] = LAYOUT(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||
|
||||
[3] = LAYOUT(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
1
keyboards/smartkit/macro8_line/keymaps/via/rules.mk
Normal file
1
keyboards/smartkit/macro8_line/keymaps/via/rules.mk
Normal file
@ -0,0 +1 @@
|
||||
VIA_ENABLE = yes
|
2
keyboards/smartkit/macro8_line/rules.mk
Normal file
2
keyboards/smartkit/macro8_line/rules.mk
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
DYNAMIC_MACRO_ENABLE = yes
|
93
keyboards/smartkit/macropad/info.json
Normal file
93
keyboards/smartkit/macropad/info.json
Normal file
@ -0,0 +1,93 @@
|
||||
{
|
||||
"keyboard_name": "MacroPad",
|
||||
"manufacturer": "SmartKit",
|
||||
"url": "smartkit.si",
|
||||
"maintainer": "qmk",
|
||||
"usb": {
|
||||
"vid": "0x6000",
|
||||
"pid": "0x6061",
|
||||
"device_version": "0.0.3"
|
||||
},
|
||||
"matrix_pins": {
|
||||
"cols": ["B5", "B6", "B2", "B3", "F7"],
|
||||
"rows": ["D4", "C6", "D7", "E6", "B4" ]
|
||||
},
|
||||
"diode_direction": "ROW2COL",
|
||||
"encoder": {
|
||||
"rotary": [
|
||||
{"pin_a": "F5", "pin_b": "F6", "resolution": 1}
|
||||
]
|
||||
},
|
||||
"features": {
|
||||
"bootmagic": true,
|
||||
"command": false,
|
||||
"console": false,
|
||||
"extrakey": true,
|
||||
"key_lock": true,
|
||||
"mousekey": true,
|
||||
"nkro": true,
|
||||
"rgblight": true
|
||||
},
|
||||
"bootmagic": {
|
||||
"matrix": [1, 0]
|
||||
},
|
||||
"dynamic_keymap": {
|
||||
"layer_count": 2
|
||||
},
|
||||
"rgblight": {
|
||||
"led_count": 20,
|
||||
"animations": {
|
||||
"breathing": true,
|
||||
"rainbow_mood": true,
|
||||
"rainbow_swirl": true,
|
||||
"snake": true,
|
||||
"knight": true,
|
||||
"christmas": false,
|
||||
"static_gradient": true,
|
||||
"rgb_test": true,
|
||||
"alternating": false,
|
||||
"twinkle": true
|
||||
}
|
||||
},
|
||||
"ws2812": {
|
||||
"pin": "B1"
|
||||
},
|
||||
"processor": "atmega32u4",
|
||||
"bootloader": "atmel-dfu",
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{"matrix": [0, 0], "x": 0, "y": 0},
|
||||
{"matrix": [0, 1], "x": 1, "y": 0},
|
||||
{"matrix": [0, 2], "x": 2, "y": 0},
|
||||
{"matrix": [0, 3], "x": 3, "y": 0},
|
||||
{"matrix": [0, 4], "x": 4, "y": 0},
|
||||
|
||||
{"matrix": [1, 0], "x": 0, "y": 1},
|
||||
{"matrix": [1, 1], "x": 1, "y": 1},
|
||||
{"matrix": [1, 2], "x": 2, "y": 1},
|
||||
{"matrix": [1, 3], "x": 3, "y": 1},
|
||||
{"matrix": [1, 4], "x": 4, "y": 1},
|
||||
|
||||
{"matrix": [2, 0], "x": 0, "y": 2},
|
||||
{"matrix": [2, 1], "x": 1, "y": 2},
|
||||
{"matrix": [2, 2], "x": 2, "y": 2},
|
||||
{"matrix": [2, 3], "x": 3, "y": 2},
|
||||
{"matrix": [2, 4], "x": 4, "y": 2},
|
||||
|
||||
{"matrix": [3, 0], "x": 0, "y": 3},
|
||||
{"matrix": [3, 1], "x": 1, "y": 3},
|
||||
{"matrix": [3, 2], "x": 2, "y": 3},
|
||||
{"matrix": [3, 3], "x": 3, "y": 3},
|
||||
{"matrix": [3, 4], "x": 4, "y": 3},
|
||||
|
||||
{"matrix": [4, 0], "x": 0, "y": 4},
|
||||
{"matrix": [4, 1], "x": 1, "y": 4},
|
||||
{"matrix": [4, 2], "x": 2, "y": 4},
|
||||
{"matrix": [4, 3], "x": 3, "y": 4},
|
||||
{"matrix": [4, 4], "x": 4, "y": 4}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
29
keyboards/smartkit/macropad/keymaps/default/keymap.c
Normal file
29
keyboards/smartkit/macropad/keymaps/default/keymap.c
Normal file
@ -0,0 +1,29 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT(
|
||||
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_MUTE,
|
||||
KC_P7, KC_P8, KC_P9, KC_PPLS, KC_TRNS,
|
||||
KC_P4, KC_P5, KC_P6, KC_DEL, KC_TRNS,
|
||||
KC_P1, KC_P2, KC_P3, KC_CALC, KC_TRNS,
|
||||
KC_P0, KC_PDOT, KC_COMM, KC_PENT, KC_ENT),
|
||||
|
||||
[1] = LAYOUT(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENT,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENT,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENT,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENT,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
|
||||
|
||||
};
|
||||
|
||||
|
||||
#ifdef ENCODER_MAP_ENABLE
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
|
||||
[1] = { ENCODER_CCW_CW(_______, _______) }
|
||||
};
|
||||
#endif
|
||||
|
2
keyboards/smartkit/macropad/keymaps/default/rules.mk
Normal file
2
keyboards/smartkit/macropad/keymaps/default/rules.mk
Normal file
@ -0,0 +1,2 @@
|
||||
ENCODER_MAP_ENABLE = yes
|
||||
|
29
keyboards/smartkit/macropad/keymaps/via/keymap.c
Normal file
29
keyboards/smartkit/macropad/keymaps/via/keymap.c
Normal file
@ -0,0 +1,29 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT(
|
||||
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, KC_MUTE,
|
||||
KC_P7, KC_P8, KC_P9, KC_PPLS, KC_TRNS,
|
||||
KC_P4, KC_P5, KC_P6, KC_DEL, KC_TRNS,
|
||||
KC_P1, KC_P2, KC_P3, KC_CALC, KC_TRNS,
|
||||
KC_P0, KC_PDOT, KC_COMM, KC_PENT, KC_ENT),
|
||||
|
||||
[1] = LAYOUT(
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENT,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENT,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENT,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENT,
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS)
|
||||
|
||||
};
|
||||
|
||||
|
||||
#ifdef ENCODER_MAP_ENABLE
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
|
||||
[1] = { ENCODER_CCW_CW(_______, _______) }
|
||||
};
|
||||
#endif
|
||||
|
3
keyboards/smartkit/macropad/keymaps/via/rules.mk
Normal file
3
keyboards/smartkit/macropad/keymaps/via/rules.mk
Normal file
@ -0,0 +1,3 @@
|
||||
ENCODER_MAP_ENABLE = yes
|
||||
VIA_ENABLE = yes
|
||||
|
2
keyboards/smartkit/macropad/rules.mk
Normal file
2
keyboards/smartkit/macropad/rules.mk
Normal file
@ -0,0 +1,2 @@
|
||||
ENCODER_ENABLE = yes
|
||||
DYNAMIC_MACRO_ENABLE = yes
|
@ -1,5 +1,6 @@
|
||||
"""This script automates the copying of the default keymap into your own keymap.
|
||||
"""
|
||||
import re
|
||||
import shutil
|
||||
|
||||
from milc import cli
|
||||
@ -13,6 +14,13 @@ from qmk.keyboard import keyboard_completer, keyboard_folder
|
||||
from qmk.userspace import UserspaceDefs
|
||||
|
||||
|
||||
def validate_keymap_name(name):
|
||||
"""Returns True if the given keymap name contains only a-z, 0-9 and underscore characters.
|
||||
"""
|
||||
regex = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9_]+$')
|
||||
return bool(regex.match(name))
|
||||
|
||||
|
||||
def prompt_keyboard():
|
||||
prompt = """{fg_yellow}Select Keyboard{style_reset_all}
|
||||
If you`re unsure you can view a full list of supported keyboards with {fg_yellow}qmk list-keyboards{style_reset_all}.
|
||||
@ -60,6 +68,10 @@ def new_keymap(cli):
|
||||
cli.log.error(f'Default keymap {{fg_cyan}}{keymap_path_default}{{fg_reset}} does not exist!')
|
||||
return False
|
||||
|
||||
if not validate_keymap_name(user_name):
|
||||
cli.log.error('Keymap names must contain only {fg_cyan}a-z{fg_reset}, {fg_cyan}0-9{fg_reset} and {fg_cyan}_{fg_reset}! Please choose a different name.')
|
||||
return False
|
||||
|
||||
if keymap_path_new.exists():
|
||||
cli.log.error(f'Keymap {{fg_cyan}}{user_name}{{fg_reset}} already exists! Please choose a different name.')
|
||||
return False
|
||||
|
@ -29,6 +29,7 @@ def _convert_macros(via_macros):
|
||||
if len(via_macros) == 0:
|
||||
return list()
|
||||
split_regex = re.compile(r'(}\,)|(\,{)')
|
||||
macro_group_regex = re.compile(r'({.+?})')
|
||||
macros = list()
|
||||
for via_macro in via_macros:
|
||||
# Split VIA macro to its elements
|
||||
@ -38,13 +39,28 @@ def _convert_macros(via_macros):
|
||||
macro_data = list()
|
||||
for m in macro:
|
||||
if '{' in m or '}' in m:
|
||||
# Found keycode(s)
|
||||
keycodes = m.split(',')
|
||||
# Remove whitespaces and curly braces from around keycodes
|
||||
keycodes = list(map(lambda s: s.strip(' {}'), keycodes))
|
||||
# Remove the KC prefix
|
||||
keycodes = list(map(lambda s: s.replace('KC_', ''), keycodes))
|
||||
macro_data.append({"action": "tap", "keycodes": keycodes})
|
||||
# Split macro groups
|
||||
macro_groups = macro_group_regex.findall(m)
|
||||
for macro_group in macro_groups:
|
||||
# Remove whitespaces and curly braces from around group
|
||||
macro_group = macro_group.strip(' {}')
|
||||
|
||||
macro_action = 'tap'
|
||||
macro_keycodes = []
|
||||
|
||||
if macro_group[0] == '+':
|
||||
macro_action = 'down'
|
||||
macro_keycodes.append(macro_group[1:])
|
||||
elif macro_group[0] == '-':
|
||||
macro_action = 'up'
|
||||
macro_keycodes.append(macro_group[1:])
|
||||
else:
|
||||
macro_keycodes.extend(macro_group.split(',') if ',' in macro_group else [macro_group])
|
||||
|
||||
# Remove the KC prefixes
|
||||
macro_keycodes = list(map(lambda s: s.replace('KC_', ''), macro_keycodes))
|
||||
|
||||
macro_data.append({"action": macro_action, "keycodes": macro_keycodes})
|
||||
else:
|
||||
# Found text
|
||||
macro_data.append(m)
|
||||
@ -54,13 +70,13 @@ def _convert_macros(via_macros):
|
||||
|
||||
|
||||
def _fix_macro_keys(keymap_data):
|
||||
macro_no = re.compile(r'MACRO0?([0-9]{1,2})')
|
||||
macro_no = re.compile(r'MACRO0?\(([0-9]{1,2})\)')
|
||||
for i in range(0, len(keymap_data)):
|
||||
for j in range(0, len(keymap_data[i])):
|
||||
kc = keymap_data[i][j]
|
||||
m = macro_no.match(kc)
|
||||
if m:
|
||||
keymap_data[i][j] = f'MACRO_{m.group(1)}'
|
||||
keymap_data[i][j] = f'MC_{m.group(1)}'
|
||||
return keymap_data
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user