Skip to content

feat: add copy/paste layer support - #2986

Closed
mondalaci wants to merge 2 commits into
masterfrom
issue-2692-copy-paste-layers
Closed

feat: add copy/paste layer support#2986
mondalaci wants to merge 2 commits into
masterfrom
issue-2692-copy-paste-layers

Conversation

@mondalaci

Copy link
Copy Markdown
Member

Summary

Implements copy/paste of layers, as requested in #2692.

  • Adds Copy and Paste buttons to the layer header (to the right of the layer button group, left of the help ? icon). The Paste button appears once a layer has been copied.
  • Copy stores the current layer in an in-memory "virtual clipboard" (NgRx store), so it can be pasted onto any layer — including in another keymap or on another device.
  • Paste overwrites the currently selected layer with the copied layer.

Cross-context safety

Paste is guarded so it can never produce an invalid configuration:

  • Macros are re-linked by name (macro names are unique). If the target config has no macro with that name, the key becomes a NoneAction (color preserved).
  • Switch-keymap references are kept only if the referenced keymap abbreviation still exists; otherwise the key becomes a NoneAction (color preserved). This avoids serializing a -1 keymap index.
  • Structural merge: modules are matched by id and key count, so a layer copied from a different keyboard/layout (e.g. UHK60 ↔ UHK80, ANSI ↔ ISO) can never desync the target's module structure. Modules without a compatible counterpart keep their existing content.

SwitchLayerAction, keystroke secondary roles, and ConnectionsAction host-connection references are left untouched — they serialize to fixed/valid values and at worst become semantically "dead" keys until the relevant layer/connection exists (no corruption).

Notes

  • Partial pastes (some incompatible modules skipped) are intentionally silent.
  • No undo for paste yet; a general undo/redo is planned separately and would cover this for free.

Test plan

  • Copy a layer, verify the Paste button appears.
  • Paste onto a different layer in the same keymap; verify key actions, colors, and macro/switch-keymap keys are correct.
  • Paste into a different keymap; verify macro keys re-link by name and switch-keymap keys survive/clear correctly.
  • Copy on one device, paste on another (different layout); verify no structural corruption and config saves/loads cleanly.
  • Verify buttons don't appear on the add-keymap preview screen.

Made with Cursor

mondalaci and others added 2 commits July 7, 2026 22:10
…, and toggleable log

- Show a determinate per-device progress bar with live percentage during
  firmware flashing, wired from the mcumgr/kboot write operations through
  a new moduleFirmwareUpgradeProgress IPC event.
- Surface the "connect the left/right half via USB" prompt as a prominent,
  easily-noticeable warning on the firmware screen via a dedicated IPC
  signal instead of relying on the update log.
- Hide the firmware update log by default and add a Show/Hide toggle that
  appears once the log has any text.

Implements #2593.

Co-authored-by: Cursor <cursoragent@cursor.com>
Adds copy and paste buttons to the layer header so a layer can be copied
to a virtual clipboard and pasted onto any layer, overwriting it (closes #2692).

Paste is safe across keymaps and devices:
- macro references are re-linked by name, falling back to a none action
- dangling switch-keymap references fall back to a none action
- modules are merged by id and key count so a layer copied from a different
  keyboard or layout can never desync the target's structure

Co-authored-by: Cursor <cursoragent@cursor.com>
@ert78gb

ert78gb commented Jul 10, 2026

Copy link
Copy Markdown
Member

superseded by #2992

@ert78gb ert78gb closed this Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants