qanata

March 30, 2026 ยท View on GitHub

Application-aware layer switching for kanata on sway.

qanata watches the focused sway window and tells kanata which layer to use.

How it works

  1. main is the default layer.
  2. If the focused application matches a file in ~/.config/keyboard/apps/, qanata switches to that layer.
  3. If no matching file exists, qanata falls back to main.

Example:

~/.config/keyboard/apps/org.telegram.desktop

If Telegram is focused, qanata sends org.telegram.desktop to kanata and kanata switches to that layer.

Run

cargo run -- --port 7070

Useful flags:

  • --debug for debug logs
  • --trace for trace logs
  • --white-list-file <path> to ignore apps that should not trigger layer changes

Overlay

The overlay window is optional and controlled by the overlay feature:

cargo run --features overlay -- --port 7070

Nix development shell

This repository includes a flake.nix for development dependencies.

  1. Enable Flakes in your Nix configuration.
  2. Install direnv, for example with nix profile install nixpkgs#direnv.
  3. Clone the repository and enter it.
  4. Allow the environment with direnv allow.

After that, the shell provides the build and runtime dependencies used by the project.

Statistics

The repository also includes a small script for visualizing kanata logs:

./run_stats.sh --file path/to/kanata/log

Log format:

actual_key_presses|layer|resulting_key_press

Reference

For a real configuration example, see my kanata config.

Status

This project is still experimental. It works, but it is not polished yet.