Writer

import map2

# clone existing device
writer1 = map2.Writer(clone_from = "/dev/input/by-id/example-keyboard")

# create a new virtual device with specific capabilities
writer2 = map2.Writer(capabilities = {"rel": True, "buttons": True})

Creates a virtual device that can emmit output events and behaves just like a physical devices.

Supported on:

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

Options

clone_from

string?

Defines which output events the virtual device can emmit based on an existing device.

capabilities

{
    "rel": bool?,
    "abs": bool?,
    "buttons": bool?,
    "keys": bool?,
}

Defines which output events the virtual device can emmit.

Methods

send(input)

Sends input events as if they were received through an input node.

  • input: key_sequence