View Source AFK.Keymap (afk v0.3.2)

A keymap represents the virtual key layout of a keyboard.

It can be made up of multiple layers that can be activated and deactivated by pressing AFK.Layer keycodes.

A keymap just needs to be a list of maps, where each map is a mapping of physical key identifier (an atom), to an AFK.Keycode.Keycode.

For example:

[
  # Layer 0 (default)
  %{
    k001: AFK.Keycode.Key.new(:a),
    k002: AFK.Keycode.Modifier.new(:left_control),
    k003: AFK.Keycode.Layer.new(:hold, 1),
    k004: AFK.Keycode.Key.new(:caps_lock)
  },
  # Layer 1
  %{
    k001: AFK.Keycode.Key.new(:z),
    k002: AFK.Keycode.Modifier.new(:right_super),
    k003: AFK.Keycode.None.new(),
    k004: AFK.Keycode.Transparent.new()
  }
]

Link to this section Summary

Functions

Loads a keymap from a file.

Saves a keymap to a file.

Link to this section Types

@type layer() :: %{required(atom()) => AFK.Keycode.t()}
@type t() :: [layer()]

Link to this section Functions

Link to this function

load_from_file!(filename)

View Source
@spec load_from_file!(filename :: binary()) :: t()

Loads a keymap from a file.

Link to this function

save_to_file!(keymap, filename)

View Source
@spec save_to_file!(keymap :: t(), filename :: binary()) :: :ok

Saves a keymap to a file.