Draft
feat: Export keymap as ZMK .keymap file snippet#63
Conversation
Co-authored-by: cormoran <7994064+cormoran@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add feature to export current keymap in ZMK format
feat: Export keymap as ZMK .keymap file snippet
Feb 20, 2026
🚀 Cloudflare Workers PreviewPreview URL: https://9e056093-dya-studio.cormoran707.workers.dev Deployed from commit 572cbbe |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a popup export dialog on the Keymap page that generates a ZMK DTS
.keymapsnippet from the current in-memory keymap, with a copy-to-clipboard button.Changes
src/lib/zmkExport.ts— Core export logic:getZMKKeycodeName(hidUsage)— HID usage → ZMK keycode name (letters,N1–N0number row,F1–F24, modifiers, consumer/media, modifier wrapping e.g.LS(A))bindingToZMKString(binding, behavior)— binding → ZMK DTS token (&kp A,&mo 1,< 1 A,&bt BT_CLR,&out OUT_USB,&mkp LCLK,&mmv MOVE_UP, etc.)generateZMKKeymapContent(params)— assembles full/ { keymap { ... } }block; groups bindings into rows by physical key Y position; includessensor-bindingswhen sensor data providedsrc/components/KeymapExportDialog.tsx— RadixDialogshowing the generated snippet in a monospace block with copy button (Copied / Copy failed feedback states)src/pages/KeymapPage.tsx— Export button added to action bar when connected;exportContentcomputed viauseMemoExample output
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.