Skip to content

About

Cross-platform desktop GUI and visual layout editor for Kanata

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Kanata Studio

Kanata Studio is an Avalonia editor for native Kanata keyboard profiles on Windows and Linux. Pick keys, compose actions, and edit aliases and chords visually. Run the current layout with your installed Kanata executable or export it as a checked profile. A portable .NET helper manages per-user login entries on Windows, Linux, and macOS. Development handoff

Windows installer

The x64 installer targets Windows 10 22H2 and Windows 11. It installs for the current user, adds a Kanata Studio Start menu shortcut, and includes the .NET runtime. Install a Kanata TTY executable separately and choose it under Settings → Select Kanata binary… if Studio does not find it on PATH. Studio releases · Kanata releases

Once the package is listed in the WinGet community catalog, use these commands to install, update, or uninstall it. You can also uninstall from Settings → Apps → Installed apps.

winget install --id helldio.KanataStudio --exact --source winget
winget upgrade --id helldio.KanataStudio --exact --source winget
winget uninstall --id helldio.KanataStudio --exact

To build a new installer and prepare its catalog submission, follow the Windows release guide.

Linux packages

Build recipes are available for AppImage, local Flatpak bundles, and the kanata-studio-git AUR package. AppImage and Flatpak bundle .NET; the AUR recipe uses the system .NET runtime. Install Kanata separately. These recipes have not been submitted to a package catalog. Flatpak has additional engine and login limitations described in the Linux packaging guide.

./packaging/linux/build.sh appimage x64
./packaging/linux/build.sh flatpak x64
# On Arch Linux, copy packaging/aur/PKGBUILD to a build directory and run makepkg -s.

The guide lists prerequisites, ARM64 builds, artifact locations, sandbox permissions, and release acceptance checks.

Build and run

Install the .NET 10 SDK and a Kanata TTY executable for your operating system. On Linux, use an X11 session or a Wayland session with XWayland enabled. Avalonia 11 uses the X11 backend in both cases. Debian-based systems need libx11-6, libice6, libsm6, and libfontconfig1. Avalonia Linux guide · Kanata releases

Run these commands from the repository root.

dotnet build KanataGui.slnx
dotnet run --no-build --project src/KanataGui

For a release build, add -c Release to both commands.

Open Settings → About Kanata Studio… to see the version of the running build. Builds from a full Git checkout derive the version from Conventional Commits. Versioning rules

Edit a keymap

  1. Start with the 85-key ANSI 75% / ThinkPad identity-mapped keyboard or use Open… to select a UTF-8 .kbd profile. New restores this identity template as an untitled kanata.kbd.
  2. Choose a layer, or click + and enter a name. Start with transparent keys (_) or copy bindings from an existing layer. To reach a layer named nav while typing, assign (layer-while-held nav) to a key on your base layer.
  3. Select a key to see its current expression in the inspector below the keyboard. Click Edit binding… or double-click the key, then choose Choose action…. Click a keyboard key or search the categorized list, add modifier pills, and expand Kanata preview to inspect the result. Click Apply in the picker and again in the binding dialog. Edit native expression also supports Enter to apply and Shift+Enter for a line break. Cancel discards the dialog's draft.
  4. An asterisk in the title and the Unsaved edits badge mark changes since the last open or save. Save (Ctrl+S) validates and writes the active file. The first save asks for a destination. Export… (Ctrl+Shift+S) chooses a destination and makes it the active profile. If another application changed the file on disk, direct save reports the conflict. Opening another profile, creating a new one, or closing the window prompts before discarding edits.

Before the first overwrite of each profile in a Studio session, Save and Export copy the current file to a sibling such as kanata.kbd.bak. Later saves in the same session keep that copy. The first overwrite in a new session refreshes the backup. If backup creation fails, Studio leaves the profile on disk and reports the failure. To recover, open the backup as a native profile or copy it to a new .kbd file.

Invalid action syntax and invalid or duplicate layer names show an inline message and disable the dialog's commit button until corrected.

Keyboard view and layers

Physical layout arranges the keys from the file's defsrc. Unmapped keys appear on dimmer keycaps. Click one and apply a binding to insert it in visual order, from top to bottom and left to right. Each other layer receives the key's identity action at the same position. Studio includes ANSI 60%, ANSI 65%, ANSI 75% / ThinkPad, ANSI TKL (80%), ANSI Full-size (100%), ABNT2 / ISO, ABNT2 75%, ABNT2 Full-size (100%), ThinkPad ABNT, and Split / Ortho Grid. Opening a profile with ISO and numpad keys selects ABNT2 Full-size (100%). With ISO keys alone it selects ABNT2 / ISO.

Split / Ortho Grid has a six-unit left half, a one-unit gap, and an eight-unit right half, with 5/T/G/B on the left and 6/Y/H/N on the right. Both Space thumb keys edit the same source binding. ABNT2 Full-size uses the Brazilian 107-key numpad with separate kp. and kp, keys. The keyboard scales to the available space, including at the 580 × 660 minimum window size. Keys outside the selected layout appear under Custom keys, with vertical scrolling when needed. Changing the physical layout preserves source order, bindings, and saved text.

Select ThinkPad ABNT manually for the Brazilian ThinkPad with Ctrl before Fn, the stepped Enter, and PgUp and PgDn beside the Up arrow. The bottom-row / ? ° key uses Kanata source ro. The cap marked ; : uses source /. Hover over a cap to see its full binding and any secondary function-row legend. Fn, the fingerprint reader, and the TrackPoint appear as hardware indicators. Platform-specific key events depend on the keyboard firmware and Kanata backend.

Mapped keycaps show the physical key above the assigned action. ThinkPad ABNT shows a single printed legend when the binding matches the source. Hover for the full native expression. A blue border marks the selected key. Amber marks an edited binding. The markers TH, TD, M, LYR, and OVR identify tap-hold, tap-dance, macro, layer activation, and fork/switch actions, including references to locally defined aliases.

Duplicate copies the selected layer, including its formatting. Rename updates the declaration and matching activation actions, switch layer conditions, and disabled-chord entries in the main file. For an action targeting a simple local variable, Studio updates the operand and preserves the variable declaration. Delete asks for confirmation and offers a replacement when other definitions reference the layer. Deleting the base promotes the next layer. Keep at least one positional layer.

The visual editor reads one nonempty top-level defsrc and positional deflayer forms in the main file. A layer must contain one action per source key. Each key shows its source name above its binding. Hover over a key to see the full expression. Adding a layer appends a native deflayer to the profile. Editing a binding replaces just that action. Use a text editor for layouts defined through includes, templates, or deflayermap. Kanata configuration guide

Profile settings

Open Settings and choose Profile Settings… to edit the profile's global Kanata options. Search by label or directive name, browse by category, or use In this profile to show the options specified in the main file. The settings cover keyboard and layer behavior, tap-hold and chord timing, sequences, dynamic macros, mouse behavior, and platform-specific device and tray options.

Use Kanata default to remove an explicit value and let the installed engine choose its default. Options such as input device lists show an example in their native syntax. Invalid draft values disable Apply and identify the setting that needs correction. Apply keeps the changes in the editor, and Cancel discards the draft. Use Edit profile source… when a template generates the defcfg option pairs. Save, Export, and Run check the result against the selected Kanata build. Platform and backend requirements appear next to the relevant options. Kanata profile options

Source in the toolbar opens the current draft as native .kbd text with line numbers. Validate checks the draft with the selected Kanata executable; Use edits checks it again before applying it to the visual editor. Relative includes resolve beside the opened profile. Edit profile source… in Profile Settings opens the settings draft in the same editor. Use it to define sequences and virtual keys, add includes, or edit newer directives. Use edits returns the source to the settings draft. The visual editor requires a main-file defsrc and a positional deflayer. Kanata configuration guide

Custom physical layouts

Choose Import... beside Physical layout, then open a UTF-8 JSON layout file. Studio validates it, installs a personal copy, and selects it for the current profile. If the filename, layout ID, or display name is already in use, Studio appends a numeric suffix to the conflicting value. Import errors appear below the keyboard. Opening another profile selects an inferred built-in layout. The imported layout remains available in the selector.

Studio also discovers JSON files when it starts. Put personal layouts in %AppData%\KanataStudio\layouts on Windows or $XDG_CONFIG_HOME/kanata-studio/layouts on Linux. If XDG_CONFIG_HOME has no absolute path, use ~/.config/kanata-studio/layouts. You can also place JSON files in the layouts/ directory beside the executable. Personal layouts take precedence over app-local custom layouts with the same ID. Built-in IDs are reserved. Studio falls back to the embedded preset if a shipped JSON file is missing or invalid. To remove a personal layout, delete its installed JSON file and reopen Studio.

Field Meaning
id, name A unique, case-insensitive layout ID and a display name. Both must be nonempty strings.
description Optional description.
keys One or more key objects. Each ordinary key has a keyCode matching a single Kanata defsrc token, such as ; or spc. Kanata resolves those names when checking the profile, including names defined by deflocalkeys.
label, secondaryLabel Optional printed cap legend and tooltip detail. For example, a cap can display ç while its source token is ;.
x, y, w, h Key origin and dimensions in key units (u). X increases to the right and Y increases down. Fractional and negative coordinates are accepted. Width and height must be positive.
isoEnter Optional L-shaped Enter. Set h above 1 and set topWidth to w. The narrower, positive bottomWidth starts 1u down and aligns to the right edge.
aliases Optional additional source names for a position. Repeating a keyCode lets multiple caps share a source binding.
component Optional passive hardware marker (fn, fingerprintReader, or trackPoint). Leave out keyCode, aliases, and isoEnter for a passive component.
splitBackspace Optional alternate first row. topRow replaces keys starting between 0u and 1u on Y when at least one source name in every group in whenSourceHas is present. See layouts/ansi-60.json.

Save this 36-key Corne-style example as corne-36.json and import it. Use the key codes that appear in your own profile's defsrc if your keyboard firmware sends different keys.

{
  "id": "corne-36",
  "name": "Corne-style 36-key split",
  "description": "Two staggered halves with three thumb keys each.",
  "keys": [
    {"keyCode": "q", "x": 0, "y": 0.45, "w": 1, "h": 1},
    {"keyCode": "w", "x": 1, "y": 0.25, "w": 1, "h": 1},
    {"keyCode": "e", "x": 2, "y": 0, "w": 1, "h": 1},
    {"keyCode": "r", "x": 3, "y": 0.15, "w": 1, "h": 1},
    {"keyCode": "t", "x": 4, "y": 0.3, "w": 1, "h": 1},
    {"keyCode": "y", "x": 7, "y": 0.3, "w": 1, "h": 1},
    {"keyCode": "u", "x": 8, "y": 0.15, "w": 1, "h": 1},
    {"keyCode": "i", "x": 9, "y": 0, "w": 1, "h": 1},
    {"keyCode": "o", "x": 10, "y": 0.25, "w": 1, "h": 1},
    {"keyCode": "p", "x": 11, "y": 0.45, "w": 1, "h": 1},
    {"keyCode": "a", "x": 0, "y": 1.45, "w": 1, "h": 1},
    {"keyCode": "s", "x": 1, "y": 1.25, "w": 1, "h": 1},
    {"keyCode": "d", "x": 2, "y": 1, "w": 1, "h": 1},
    {"keyCode": "f", "x": 3, "y": 1.15, "w": 1, "h": 1},
    {"keyCode": "g", "x": 4, "y": 1.3, "w": 1, "h": 1},
    {"keyCode": "h", "x": 7, "y": 1.3, "w": 1, "h": 1},
    {"keyCode": "j", "x": 8, "y": 1.15, "w": 1, "h": 1},
    {"keyCode": "k", "x": 9, "y": 1, "w": 1, "h": 1},
    {"keyCode": "l", "x": 10, "y": 1.25, "w": 1, "h": 1},
    {"keyCode": ";", "x": 11, "y": 1.45, "w": 1, "h": 1},
    {"keyCode": "z", "x": 0, "y": 2.45, "w": 1, "h": 1},
    {"keyCode": "x", "x": 1, "y": 2.25, "w": 1, "h": 1},
    {"keyCode": "c", "x": 2, "y": 2, "w": 1, "h": 1},
    {"keyCode": "v", "x": 3, "y": 2.15, "w": 1, "h": 1},
    {"keyCode": "b", "x": 4, "y": 2.3, "w": 1, "h": 1},
    {"keyCode": "n", "x": 7, "y": 2.3, "w": 1, "h": 1},
    {"keyCode": "m", "x": 8, "y": 2.15, "w": 1, "h": 1},
    {"keyCode": ",", "x": 9, "y": 2, "w": 1, "h": 1},
    {"keyCode": ".", "x": 10, "y": 2.25, "w": 1, "h": 1},
    {"keyCode": "/", "x": 11, "y": 2.45, "w": 1, "h": 1},
    {"keyCode": "lctl", "label": "Ctrl", "x": 2.5, "y": 3.6, "w": 1, "h": 1},
    {"keyCode": "lalt", "label": "Alt", "x": 3.5, "y": 3.7, "w": 1, "h": 1},
    {"keyCode": "spc", "label": "Space", "x": 4.5, "y": 3.8, "w": 1, "h": 1},
    {"keyCode": "ret", "label": "Enter", "x": 6.5, "y": 3.8, "w": 1, "h": 1},
    {"keyCode": "ralt", "label": "Alt", "x": 7.5, "y": 3.7, "w": 1, "h": 1},
    {"keyCode": "rctl", "label": "Ctrl", "x": 8.5, "y": 3.6, "w": 1, "h": 1}
  ]
}

Windows AltGr

On Windows, assigning a new action to RAlt / AltGr automatically enables Cancel LCtrl press when the profile has no windows-altgr setting. This suppresses the extra Left Ctrl press Windows can generate on international layouts such as ABNT2. Studio reports the change below the keyboard.

To change the setting, open Settings and choose Profile Settings…. Under Windows, choose AltGr handling, then Cancel LCtrl press, Add LCtrl release, or Kanata default. The default removes the directive from defcfg. Click Apply, then Save to write the change to the profile or Run to use it in the current session. Kanata AltGr configuration

Advanced actions

In the action palette below the inspector, Tap-Dance, Macros, and Overrides list the corresponding named actions and direct key bindings across layers. Choose an entry to edit it, or create a named action to assign to a key. Aliases opens all of the main file's named actions. Create an alias or edit its action with the same picker used on the keyboard. Inside the picker, Alias searches available declarations and can create a new alias within the current draft. Nested dialogs apply to their parent. Save or Export writes the changes to disk.

Picker Controls
Layer Select a named layer and an activation mode. Badges show the initial base layer and layers referenced by momentary or permanent actions. Both layer-toggle and layer-while-held activate a layer while held.
Tap-hold Set tap and hold timeouts and choose each action separately. The release-keys variant adds a multi-select physical keyboard for early taps.
Tap-dance Choose standard or eager recognition, set the timeout, and add an action for each successive tap.
Macro Add key/shortcut, Unicode text, and delay blocks. Drag the handle or use the arrows to reorder. Select release-cancel to stop playback on release. Number keys and millisecond delays have separate encodings.
Fork Pick base and alternate actions and the triggering modifiers. Suppress modifiers releases the selected modifiers for the alternate action.
Switch Add ordered rules for the active layer, held output key, or key history position (1–8). Choose the matching action and whether to break or continue. Set the default action for unmatched cases.
Unicode Enter a character or string. A single character generates one Unicode action. Longer text generates a macro of Unicode actions.
Special Set a one-shot modifier or layer and timeout, configure Caps Word capitalization and continuation keys, or select live reload, transparent, or no action.

Open Chords to create, edit, or delete a global input chord. Click at least two keys, choose its output, set the timeout (40 ms initially), select a release behavior, and mark any disabled layers. Applying the first chord enables Kanata's required concurrent-tap-hold setting. Deleting a chord preserves the other rows and leaves this setting available for other bindings.

The picker reads supported actions from existing profiles. An unfamiliar action can be retained in place or replaced. Studio keeps the native source, including unsupported directives, unknown defcfg options, comments, line endings, and includes. A binding edit changes its source span. If a replacement removes the part of the binding that held a comment, Studio keeps the comment immediately before the new action. The parser resolves includes during validation. Visual selectors enumerate supported definitions in the main file.

Run the current layout

Click Run (F5) to activate your current edits, including changes you have yet to export. Studio writes a temporary snapshot beside an opened profile so relative includes resolve in its directory. For a new profile it uses the temporary directory. Studio checks the snapshot with the selected Kanata executable and starts the same executable with that snapshot after a successful check. If validation fails, Studio opens the process log at the parser diagnostic.

Restart with edits checks a fresh snapshot, then stops the owned process and starts Kanata with the new layout. A rejected snapshot leaves the previous session running. Stop and closing the window end the session. Studio removes its snapshot when the process exits. An opened profile needs a writable directory for the snapshot. A key bound to Live reload reloads the file used by that Kanata process.

Ctrl+F5 restarts when changes are pending. Shift+F5 stops the owned process. The status bar shows the session state, executable, source profile and loaded snapshot. It continues to identify the running session if you open another profile. Expand Process log for validation diagnostics and recent live process output. Errors open the drawer automatically. Kanata's physical emergency exit is LCtrl + Space + Esc.

On Linux, Run and Restart with edits check that the current user can open /dev/uinput after validating the configuration. The process log reports a missing device or insufficient permissions. Configure device access for your account using the Kanata Linux setup instructions. Parser checks for Save and Export work without input-device access. Kanata Linux installation

Export and reopen

The status area shows the parser executable for this session. On Windows, Studio looks on PATH for kanata_windows_tty_winIOv2_x64.exe, then kanata.exe. On Linux, it looks for an executable kanata or a release binary name such as kanata_linux_x64. Open Settings and choose Select Kanata binary… to change the executable.

Choose Export… and select a destination. The suggested filename is kanata.kbd for new profiles and the current filename for opened profiles. Confirm replacement if the file exists. Place any files referenced by relative includes at the corresponding paths under the destination directory. Studio writes a temporary sibling and runs Kanata there with --check --no-wait --cfg. A successful check moves the candidate to the chosen filename. Use Open… to reopen it.

If the parser rejects the candidate, the process log shows its exit code and diagnostics. The temporary filename in the message refers to the edited document. Correct the binding or restore the referenced include and export again. A rejected export leaves your edits available and preserves the previous destination. For a write error, choose a writable directory or release the lock on the destination file.

Start Kanata at login

Windows. Open or export a profile, open Settings, choose Startup / Run on Login…, enable Start Kanata automatically on user login, select a silent GUI binary, and apply. The matching TTY build must be beside it or on PATH so Studio can validate the saved profile. The selector lists installed GUI variants, including winIOv2, wintercept, and command-enabled builds. Studio creates Kanata Studio.lnk in the current user's Startup folder with the GUI executable as the target, --cfg and the saved profile as arguments, and the profile directory as the working directory.

After enabling startup, opening or exporting another profile or selecting another binary refreshes the entry after a successful check. A new, untitled layout keeps the last saved login target until export. The status area shows Active, Inactive, or Misconfigured and the registered profile. A failed update displays the diagnostic and preserves the preceding entry. To remove a registration, clear the checkbox and apply.

Linux. Open or export a profile and use Settings → Startup / Run on Login…. Select the Linux Kanata executable, enable Start Kanata automatically on user login, and apply. The entry uses the validated saved profile and follows profile or binary changes as on Windows.

Linux and macOS command line. Build or run the portable startup project directly with the .NET 10 SDK. Pass the installed Kanata executable and the saved profile. Repeat enable to update either path. The following commands run from the repository root.

dotnet run --project src/KanataGui/Startup -- enable "/path/to/kanata" "/path/to/my profile.kbd"
dotnet run --project src/KanataGui/Startup -- status
dotnet run --project src/KanataGui/Startup -- disable

On Linux the helper writes $XDG_CONFIG_HOME/autostart/kanata.desktop, defaulting to ~/.config/autostart/kanata.desktop. Use a desktop session with XDG autostart and an account with access to the configured input devices. On macOS it writes ~/Library/LaunchAgents/com.jtroo.kanata.plist with a separate argument vector and working directory. The installed Kanata binary needs its normal device and Accessibility permissions. Entries take effect at the next graphical login. The helper reports a naming conflict if another program owns that entry. XDG executable format · Apple LaunchAgents

Run the checks

With Kanata on PATH, run the checks on Windows or Linux. The Windows shortcut checks also require the GUI companion of the installed TTY executable.

dotnet test KanataGui.slnx
dotnet run --project tests/KanataGui.Checks

Both commands run the console harness. To supply a parser outside PATH, set KANATA_TEST_EXECUTABLE to the full path of a Kanata TTY executable, or pass the path after -- when running the console harness directly. The harness exercises advanced-action round trips, comment-preserving edits, restart, early exit, and snapshot cleanup. It prints parser exit codes and diagnostics for valid and invalid profiles with relative includes under paths containing spaces and Unicode. Startup checks use temporary directories. Linux tests exercise the uinput preflight with a probe executable.

The solution test command also generates 200 deterministic profiles across all ten keyboard presets. Each case checks the parsed model, exports through the real TTY parser, and compares UTF-8 bytes and the reopened document. A failing test identifies its preset and seed. The parser tests also exercise rejected edits and missing relative includes.

The native preservation tests edit saved workstation and text-editing fixtures that use templates, conditional definitions, layer maps, virtual keys, and relative includes. They compare the saved bytes outside the edited binding and check the final files with Kanata. They also verify backup retention, failure recovery, and save conflicts.

Physical layout tests compare the shipped JSON with the embedded presets, round-trip geometry and legends, and check custom layout discovery, import, and validation in temporary directories. The headless suite imports the documented Corne-style example and checks the cap positions and the profile text.

The Avalonia headless tests drive the modal editors and definition libraries, check native previews and inline validation, and verify the committed changes. They render Skia screenshots into artifacts/screenshots/ and audit control bounds and sibling button overlap, including at the minimum main-window size. The audit allows content in a scroll viewport when the user can scroll it fully into view. Run the headless tests without an installed Kanata binary or display server with dotnet test tests/KanataGui.Checks/Screenshots/KanataGui.Screenshots.csproj.

Repository guide

The Avalonia window owns the active immutable Keymap, selected layer, saved-text baseline, profile path, executable, and session handle. Each modal edits a draft and returns it on Apply. The platform-selected IKanataRuntimeService owns executable discovery, parser invocation, launch checks, and session creation. The portable parser indexes lists and atoms by offsets into the original UTF-8 text. Binding edits replace a single expression, and chord edits can replace individual fields. Export writes a sibling candidate, checks it with Kanata from the destination directory, and moves it into place on success.

Directory Responsibility
layouts/ Shipped JSON physical keyboard layouts
src/KanataGui.Core/ Portable native document model, source spans, keyboard geometry, and edits
src/KanataGui/ Avalonia editor, file dialogs, profile I/O, and Windows/Linux runtime adapters
src/KanataGui/Startup/ Portable startup executable, native registration adapters, and shared profile validation
tests/KanataGui.Checks/ Document, parser, file handling, and Avalonia integration checks
tests/KanataGui.Checks/Synthetic/ Seeded profile round trips through the Kanata TTY parser

The contributor guide records project boundaries and Git conventions. The handoff includes the verified checkpoint and remaining acceptance criteria. AGENTS.md · HANDOFF.md

License

Copyright © 2026 helldio.

Kanata Studio is licensed under the GNU General Public License, version 3 or any later version published by the Free Software Foundation (GPL-3.0-or-later). Full license text

About

Cross-platform desktop GUI and visual layout editor for Kanata

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages