-
-
Notifications
You must be signed in to change notification settings - Fork 39.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creates a layouts/ folder for keymaps shared between keyboards (#1609)
* include variables and .h files as pp directives * start layout compilation * split ergodoxes up * don't compile all layouts for everything * might seg fault * reset layouts variable * actually reset layouts * include rules.mk instead * remove includes from rules.mk * update variable setting * load visualizer from path * adds some more examples * adds more layouts * more boards added * more boards added * adds documentation for layouts * use lowercase names for LAYOUT_ * add layout.json files for each layout * add community folder, default keymaps for layouts * touch-up default layouts * touch-up layouts, some keyboard rules.mk * update documentation for layouts * fix up serial/i2c switches
- Loading branch information
1 parent
7260fc3
commit d2ff66a
Showing
451 changed files
with
1,651 additions
and
1,477 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
LAYOUTS_PATH := layouts | ||
LAYOUTS_REPOS := $(patsubst %/,%,$(sort $(dir $(wildcard $(LAYOUTS_PATH)/*/)))) | ||
|
||
define SEARCH_LAYOUTS_REPO | ||
LAYOUT_KEYMAP_PATH := $$(LAYOUTS_REPO)/$$(LAYOUT)/$$(KEYMAP) | ||
LAYOUT_KEYMAP_C := $$(LAYOUT_KEYMAP_PATH)/keymap.c | ||
ifneq ("$$(wildcard $$(LAYOUT_KEYMAP_C))","") | ||
-include $$(LAYOUT_KEYMAP_PATH)/rules.mk | ||
KEYMAP_C := $$(LAYOUT_KEYMAP_C) | ||
KEYMAP_PATH := $$(LAYOUT_KEYMAP_PATH) | ||
endif | ||
endef | ||
|
||
define SEARCH_LAYOUTS | ||
$$(foreach LAYOUTS_REPO,$$(LAYOUTS_REPOS),$$(eval $$(call SEARCH_LAYOUTS_REPO))) | ||
endef | ||
|
||
$(foreach LAYOUT,$(LAYOUTS),$(eval $(call SEARCH_LAYOUTS))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Layouts: Using a keymap with multiple keyboards | ||
|
||
The `layouts/` folder contains different physical key layouts that can apply to different keyboards. | ||
|
||
``` | ||
layouts/ | ||
+ default/ | ||
| + 60_ansi/ | ||
| | + readme.md | ||
| | + layout.json | ||
| | + a_good_keymap/ | ||
| | | + keymap.c | ||
| | | + readme.md | ||
| | | + config.h | ||
| | | + rules.mk | ||
| | + <keymap folder>/ | ||
| | + ... | ||
| + <layout folder>/ | ||
+ community/ | ||
| + <layout folder>/ | ||
| + ... | ||
``` | ||
|
||
The `layouts/default/` and `layouts/community/` are two examples of layout "repositories" - currently `default` will contain all of the information concerning the layout, and one default keymap named `default_<layout>`, for users to use as a reference. `community` contains all of the community keymaps, with the eventual goal of being split-off into a separate repo for users to clone into `layouts/`. QMK searches through all folders in `layouts/`, so it's possible to have multiple reposistories here. | ||
|
||
Each layout folder is named (`[a-z0-9_]`) after the physical aspects of the layout, in the most generic way possible, and contains a `readme.md` with the layout to be defined by the keyboard: | ||
|
||
```md | ||
# 60_ansi | ||
|
||
LAYOUT_60_ansi | ||
``` | ||
|
||
New names should try to stick to the standards set by existing layouts, and can be discussed in the PR/Issue. | ||
|
||
## Supporting a layout | ||
|
||
For a keyboard to support a layout, the variable (`[a-z0-9_]`) must be defined in it's `<keyboard>.h`, and match the number of arguments/keys (and preferrably the physical layout): | ||
|
||
#define LAYOUT_60_ansi KEYMAP_ANSI | ||
|
||
The folder name must be added to the keyboard's `rules.mk`: | ||
|
||
LAYOUTS = 60_ansi | ||
|
||
`LAYOUTS` can be appended in the subproject's `rules.mk`: | ||
|
||
LAYOUTS += 60_iso | ||
|
||
but the `LAYOUT_<layout>` variable must be defined in `<subproject>.h` as well. | ||
|
||
## Tips for making layouts keyboard-agnostic | ||
|
||
Instead of using `#include "planck.h"`, you can use this line to include whatever `<keyboard>.h` (`<subproject>.h` should not be included here) file that is being compiled: | ||
|
||
#include QMK_KEYBOARD_H | ||
|
||
In your config.h, you can also use this variable to include the keyboard's `config.h`: | ||
|
||
#include QMK_KEYBOARD_CONFIG_H | ||
|
||
If you want to keep some keyboard-specific code, you can use these variables to escape it with an `#ifdef` statement: | ||
|
||
* `KEYBOARD_<keyboard>` | ||
* `SUBPROJECT_<subproject>` | ||
|
||
For example: | ||
|
||
```c | ||
#ifdef KEYBOARD_planck | ||
#ifdef SUBPROJECT_rev4 | ||
planck_rev4_function(); | ||
#endif | ||
#endif | ||
``` | ||
|
||
Note that the names are lowercase and match the folder/file names for the keyboard/subproject exactly. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
BACKLIGHT_ENABLE = no | ||
|
||
ifndef QUANTUM_DIR | ||
include ../../../Makefile | ||
endif | ||
BACKLIGHT_ENABLE = no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
BACKLIGHT_ENABLE = yes | ||
|
||
ifndef QUANTUM_DIR | ||
include ../../../Makefile | ||
endif | ||
BACKLIGHT_ENABLE = yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
BACKLIGHT_ENABLE = no | ||
|
||
ifndef QUANTUM_DIR | ||
include ../../../Makefile | ||
endif | ||
BACKLIGHT_ENABLE = no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
BACKLIGHT_ENABLE = no | ||
|
||
ifndef QUANTUM_DIR | ||
include ../../../Makefile | ||
endif | ||
BACKLIGHT_ENABLE = no |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
d2ff66a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we start a mailing list or something? I'd like to get a notice anytime we do something like this. Took me quite a while figuring out why my layout was nowhere to find. I only maintain my keyboard software once or twice a year maybe, so I can't sit read through all commits every time.
d2ff66a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've started a list of larger changes here: http://qmk.fm/changes/ - there should be an rss feed for this here.
d2ff66a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any pointer on how to make a community keyboard? I can't figure it out.
d2ff66a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean a community keymap, or a keyboard that supports different layouts? Both are talked about here
d2ff66a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too tired to read in detail now. Need to look at it another month I guess. What I wanted to do was to make
layouts/community/ergodox/swedish-lindhe
.d2ff66a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool - feel free to open an issue if you have any trouble!