Chord mapper

Creates a mapping layer that triggers on multiple keys being pressed at once or in very quick succession. When activated, it outputs a key sequence or calls a user-function.

import map2

mapper = map2.ChordMapper()

# trigger when "a" & "b" are pressed together
mapper.map(["a", "b"], "c")

# mapping to sequences is fine too
mapper.map(["z", "x"], "{backspace} wow!")

# map to user-function
def greet(): print("hello!")
mapper.map(["w", "q"], greet)

Supported on:

  • ✅ Hyprland
  • ✅ X11
  • ✅ Gnome (wayland)
  • ✅ KDE plasma (wayland)

Options

model

string?

Sets the XKB keyboard model.

layout

string?

Sets the XKB keyboard layout.

variant

string?

Sets the XKB keyboard variant.

options

string?

Sets the XKB keyboard options.

Methods

map(from, to)

Maps 2 keys, when pressed together, to a different text sequence or user-function.

  • from: [key, key]
  • to: key_sequence | () -> void