Open byronclark opened 11 months ago
Due to some of the various ways the CLI processes layouts, and the multiple entrypoints it passes through, there is a somewhat inconsistent problem to unpick.
However a somewhat gross implementation of a fix, that will work in most (all?) scenarios:
diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py
index d95ff5f923..e59b49ae6d 100644
--- a/lib/python/qmk/commands.py
+++ b/lib/python/qmk/commands.py
@@ -81,6 +81,10 @@ def build_environment(args):
if HAS_QMK_USERSPACE:
envs['QMK_USERSPACE'] = Path(QMK_USERSPACE).resolve()
+ # Handle FORCE_LAYOUT
+ if envs.get('FORCE_LAYOUT'):
+ os.environ['FORCE_LAYOUT'] = envs['FORCE_LAYOUT']
+
return envs
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py
index 5500ecdd19..acc9ad701f 100644
--- a/lib/python/qmk/info.py
+++ b/lib/python/qmk/info.py
@@ -192,6 +192,12 @@ def info_json(keyboard):
# Merge in data from <keyboard.c>
info_data = _extract_led_config(info_data, str(keyboard))
+ from os import environ
+ force_community = environ.get('FORCE_LAYOUT')
+ community_layouts = info_data.get("community_layouts", [])
+ if force_community in community_layouts:
+ info_data["community_layouts"] = [force_community]
+
# Validate
_validate(keyboard, info_data)
(Avoids chaining state everywhere by using environment to consistently stash the FORCE_LAYOUT value)
Describe the Bug
According to https://github.com/qmk/qmk_firmware/blob/master/docs/feature_layouts.md the FORCE_LAYOUT variable can be used to specify a specific layout for a keyboard and keymap that support more than one layout.
For example:
split_3x6_3
andsplit_3x5_3
split_3x6_3
layout usingmake
like thismake beekeeb/piantor:manna-harbour_miryoku FORCE_LAYOUT=split_3x6_3 QMK_USERSPACE=/home/byron/sandbox/current/qmk_userspace
To this point, everything is working as expected.
But I would like to be able to build with the
qmk compile
command like I do for my other keyboards that don't have this multiple layout issue. I would expect the following command to work:qmk compile -kb beekeeb/piantor -km manna-harbour_miryoku -e FORCE_LAYOUT=split_3x6_3
.Unfortunately, that command seems to always build the
split_3x5_3
layout. Here's what the dry-run output shows:The
MAIN_KEYMAP_PATH_
variables are only set when using external userspace and seem to be overriding theFORCE_LAYOUT
setting.Keyboard Used
beekeeb/piantor
Link to product page (if applicable)
No response
Operating System
Linux
qmk doctor Output
Is AutoHotKey / Karabiner installed
Other keyboard-related software installed
No response
Additional Context
No response