Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
'MO(2)': 'LAYER_ACCESS_3',
'MO(3)': 'LAYER_ACCESS_4',
}
EC_MAPPING = {
'INT_1': 'NONUS_BSLASH',
}
QMK_EXTRA_SCANCODES = [
"TG(0)",
"TG(1)",
Expand Down Expand Up @@ -130,7 +133,7 @@ def extract_scancodes(ecdir: str, board: str, is_qmk: bool, has_brightness: bool
common_keymap_h = open(includes[0]).read()
scancode_defines = re.findall(
'#define.*((?:K_\S+)|(?:KT_FN))', common_keymap_h)
mapping = {}
mapping = EC_MAPPING

tmpdir = tempfile.mkdtemp()
with open(f'{tmpdir}/keysym-extract.c', 'w') as f:
Expand All @@ -157,8 +160,7 @@ def extract_scancodes(ecdir: str, board: str, is_qmk: bool, has_brightness: bool
for name in scancode_defines:
if '_' in name and name.split('_')[0] != 'RGB':
name = name.split('_', 1)[1]
if is_qmk:
name = mapping.get(name, name)
name = mapping.get(name, name)
scancode_names.append(name)
scancode_list = OrderedDict(zip(scancode_names, scancodes))

Expand All @@ -167,7 +169,11 @@ def extract_scancodes(ecdir: str, board: str, is_qmk: bool, has_brightness: bool
else:
scancode_list['NONE'] = 0x0000

excluded_scancodes = ['INT_1', 'INT_2']
# INT_2 has same PS/2 scancode as BACKSLASH
excluded_scancodes = ['INT_2']
# Need new firmware to support; omit for now
if not is_qmk:
excluded_scancodes += ['SCROLL_LOCK', 'PAUSE']
if has_color or board == 'system76/bonw14':
excluded_scancodes += ['KBD_BKL']
elif has_brightness:
Expand Down Expand Up @@ -223,9 +229,7 @@ def scancode_map(x: int, code: str) -> str:
return 'NONE'

code = code.replace('K_', '').replace('KC_', '').replace('KT_', '')

if is_qmk:
code = mapping.get(code, code)
code = mapping.get(code, code)

return code

Expand Down
1 change: 1 addition & 0 deletions layouts/keyboards/system76/14in_83/keymap.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@
"NUM_7": 108,
"NUM_8": 117,
"NUM_9": 125,
"NONUS_BSLASH": 97,
"NONE": 0
}
1 change: 1 addition & 0 deletions layouts/keyboards/system76/14in_86/keymap.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@
"NUM_7": 108,
"NUM_8": 117,
"NUM_9": 125,
"NONUS_BSLASH": 97,
"NONE": 0
}
1 change: 1 addition & 0 deletions layouts/keyboards/system76/15in_102/keymap.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@
"NUM_7": 108,
"NUM_8": 117,
"NUM_9": 125,
"NONUS_BSLASH": 97,
"NONE": 0
}
1 change: 1 addition & 0 deletions layouts/keyboards/system76/15in_102_nkey/keymap.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@
"NUM_7": 108,
"NUM_8": 117,
"NUM_9": 125,
"NONUS_BSLASH": 97,
"NONE": 0
}
2 changes: 1 addition & 1 deletion layouts/system76/gaze15/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"has_color": true,
"pressed_color": "#dfdfdf",
"keyboard": "system76/15in_102"
}
}