Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Studio: keymap subsystem #2268

Merged
merged 8 commits into from
Sep 5, 2024

Conversation

petejohanson
Copy link
Contributor

@petejohanson petejohanson commented Apr 12, 2024

This PR is layered on top of #2254 showing how this will be evolving for the keymap subsystem.

Core features:

  • Adds a new "settings storage" option for keymaps for saving/restoring keymap bindings using the Zephyr settings subsystem.

Adds a new keymap subsystem that:

  • Fetches the current keymap
  • Allows setting the behavior binding (behavior + params) for a given key position in the keymap.
  • Positions with unsaved changes to the keymap are tracked.
  • Adds save and discard changes requests that will save the changed bindings to settings subsystem, or in the case of "discard" will simply reload the bindings all from settings subsystem.

Leaving this as a draft PR for now pending review of #2231 and #2254

@petejohanson petejohanson added enhancement New feature or request keymaps PRs and issues related to keymaps studio ZMK Studio (runtime keymaps) labels Apr 12, 2024
@petejohanson petejohanson self-assigned this Apr 12, 2024
@petejohanson petejohanson linked an issue Apr 12, 2024 that may be closed by this pull request
@petejohanson petejohanson force-pushed the studio/keymap-subsystem branch 6 times, most recently from ba1f1d1 to 66157f1 Compare April 22, 2024 08:46
@petejohanson petejohanson force-pushed the studio/keymap-subsystem branch 3 times, most recently from 7656aa8 to f8be471 Compare May 19, 2024 04:22
@petejohanson petejohanson force-pushed the studio/keymap-subsystem branch 8 times, most recently from fb81427 to 7585225 Compare June 9, 2024 02:17
@petejohanson petejohanson force-pushed the studio/keymap-subsystem branch 8 times, most recently from 19fe149 to 7b149df Compare June 13, 2024 18:15
@petejohanson petejohanson force-pushed the studio/keymap-subsystem branch 2 times, most recently from cd4643b to c648db4 Compare August 28, 2024 22:13
@petejohanson petejohanson force-pushed the studio/keymap-subsystem branch 6 times, most recently from 14a7781 to 5f84d95 Compare August 30, 2024 22:00

### Omit Specific Behaviors

You can omit a specific behaviors by defining a variable like `ZMK_BEHAVIORS_OMIT_FOO` at the top of your keymap:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"variable like ZMK_BEHAVIORS_OMIT_FOO" isn't super clear. Continuing the discussion above, we should have some description of how to map a behavior to a symbol to use in place of FOO.

Also, I think it is important (possibly even big warning box important) to note that these defines need to come before including behaviors.dtsi.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a note to this, and there is a note about the order needed here, but I can make it even more obvious if folks thinks this needs it.

docs/docs/features/studio.md Show resolved Hide resolved
docs/docs/features/studio.md Outdated Show resolved Hide resolved
@petejohanson petejohanson force-pushed the studio/keymap-subsystem branch 2 times, most recently from 88dc737 to 8f8b6e4 Compare September 2, 2024 18:52
app/boards/arm/bdn9/bdn9_rev2.keymap Outdated Show resolved Hide resolved
app/boards/arm/ferris/ferris_rev02.keymap Outdated Show resolved Hide resolved
docs/docs/development/hardware-integration/studio-setup.md Outdated Show resolved Hide resolved
app/src/physical_layouts.c Outdated Show resolved Hide resolved
@petejohanson petejohanson force-pushed the studio/keymap-subsystem branch 6 times, most recently from 09f1e4c to 746e981 Compare September 5, 2024 17:40
petejohanson and others added 8 commits September 5, 2024 12:02
* Add keymap API for getting/setting a bindings
  in keymap layers.
* Add layer move support via intemediary ordering array.
* Add settings storage for keymap changes.
* New shield to easily test studio using the `native_posix_64` board.
* Use defines to keep either all behaviors with omits, or selective behaviors with
  explicit kept behavior, before including `behavior.dtsi` in keymaps.
* Default ZMK_BEHAVIORS_KEEP_ALL when building with the studio RPC
  endpoint snippet.
* Make it easier to test native builds of our shields by adding
  `posix_pro_micro` and `posix_seeed_xiao` so you can build posix
  target of, e.g. `corne_left` for testing ZMK Studio.
* Add Corne and Ferris shared layouts, and update the respective
  shields to use them.
* Add a sample Hummingbird physical layout for testing posix xiao.
* Add Sofle physical layout as an additional reference.
* Document setting up studio for a new keyboard definition.
* Document how to enable ZMK Studio for a build, adding reserved layers,
  and controlling which behaviors are built into a studio firmware.
* Document `&studio_unlock` behavior.
* Document studio configuration options.

Co-authored-by: Cem Aksoylar <[email protected]>
@petejohanson petejohanson merged commit 3975d2f into zmkfirmware:main Sep 5, 2024
60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request keymaps PRs and issues related to keymaps studio ZMK Studio (runtime keymaps)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keymap loading/persisting to settings subsystem
5 participants