Skip to content

Commit 81f321d

Browse files
authored
qmk info: account for ISO enter when calculating layout X offset (qmk#20325)
1 parent 1dd2d1d commit 81f321d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/python/qmk/info.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ def _valid_community_layout(layout):
5050
return (Path('layouts/default') / layout).exists()
5151

5252

53+
def _get_key_left_position(key):
54+
# Special case for ISO enter
55+
return key['x'] - 0.25 if key.get('h', 1) == 2 and key.get('w', 1) == 1.25 else key['x']
56+
57+
5358
def _additional_validation(keyboard, info_data):
5459
"""Non schema checks
5560
"""
@@ -64,7 +69,7 @@ def _additional_validation(keyboard, info_data):
6469

6570
# Warn if physical positions are offset (at least one key should be at x=0, and at least one key at y=0)
6671
for layout_name, layout_data in layouts.items():
67-
offset_x = min([k['x'] for k in layout_data['layout']])
72+
offset_x = min([_get_key_left_position(k) for k in layout_data['layout']])
6873
if offset_x > 0:
6974
_log_warning(info_data, f'Layout "{layout_name}" is offset on X axis by {offset_x}')
7075

0 commit comments

Comments
 (0)