Skip to main content

Module keys

Module keys 

Source
Expand description

Key bindings the user edits: keybindings.toml in the app’s configuration folder, a key or a list of keys per command, in sections ([commands] for the registry’s commands, and one per part of an app that binds its own keys, as a plot’s [plot]). Read once at start (load_keybindings); each section is resolved against its defaults (resolve); a missing file is written with every default (write_default_keybindings) so the user sees what can be changed. A key that cannot be read keeps its default and is named in a notice (take_notices).

Functions§

bind_commands
Gives the registry’s commands their keys from [commands] (the first key the file names; the defaults are the commands’ own) and binds them (Registry::bind_keys). Returns what could not be bound.
load_keybindings
Reads keybindings.toml (a missing file: every default). Call once at start, before any section is resolved.
parse_key
A key as the files write it, for matching by hand: (control or command, alt, shift, key). None: not a key.
resolve
The keys of section’s commands: the file’s where it names the command, else defaults. valid says whether a key can be bound (one that cannot keeps the default). Commands the file names that defaults lacks, and one key on two commands, are noticed.
take_notices
The notices collected so far (each is given once).
write_default_keybindings
Writes keybindings.toml with every default of the sections resolved so far, when the file does not exist yet.

Type Aliases§

Keys
A section’s commands with their keys.