|
NAMEkeyd - A key remapping daemon.SYNOPSISkeyd [-m] [-l] [-d]DESCRIPTIONkeyd is a system wide key remapping daemon which supports features like layering, oneshot modifier, and macros. In its most basic form it can be used to define a custom key layout that persists accross display server boundaries (e.g wayland/X/tty).keyd is intended to run as a systemd service but is capable of running independently. The default behaviour is to run the forground and print to stderr, unless -d is supplied, in which case in which case log output will be stored in /var/log/keyd.log. NOTE Becuase keyd modifies your primary input device it is possible to render your machine unusuable with a bad config file. If you find yourself in this situation the sequence <backspace>+<backslash>+<enter> will force keyd to terminate. If you are experimenting with the available options it is advisable to do so in a keyboard specific file (see CONFIGURATION) instead of directly in default.cfg, so it remains possible to plug in another keyboard unaffected by the changes. OPTIONS-m: Run in monitor mode. (ensure keyd is not running to see untranslated events).-l: List all valid key names. -d: Fork and run in the background. CONFIGURATIONAll configuration files are stored in /etc/keyd/. The name of each file should correspond to the device name to which it is to be applied followed by .cfg (e.g “/etc/keyd/Magic Keyboard.cfg”). Configuration files are loaded upon initialization and can be reified by reloading keyd (e.g sudo systemctl restart keyd).A list of valid key names can be produced with -l. The monitor flag (-m) can also be used to obtain device and key names like so:
If no configuration file exists for a given keyboard default.cfg is used as a fallback (if present). Each line in a configuration file consists of a mapping of the following form:
or else represents the beginning of a new layer. E.G:
Where <keyseq> has the form: [<modifier1>[-<modifier2>...]-<key> and each modifier is one of: C - Control M - Meta/Super A - Alt S - Shift G - AltGr Lines can be commented out by prepending # but inline comments are not supported. In addition to simple key mappings keyd can remap keys to actions which can conditionally send keystrokes or transform the state of the keymap. It is, for instance, possible to map a key to escape when tapped and control when held by assigning it to overload(C, esc). A complete list of available actions can be found in ACTIONS. As a special case <key> may be `noop' which causes it to be ignored. This can be used to simulate a modifier sequence with no attendant termination key: E.G C-A-noop will simulate the simultaneous depression and release of the control and alt keys. LayersEach configuration file consists of one or more layers. Each layer is a keymap unto itself and can be transiently activated by a key mapped to the layer action.For example the following configuration creates a new layer called `symbols' which is activated by holding the capslock key.
Pressing capslock+f thus produces a tilde. Any set of valid modifiers is also a valid layer. For example the layer M-C corresponds to a layer which behaves like the modifiers meta and control. These play nicely with other modifiers and preserve existing stacking semantics. A layer may optionally have a parent from which mappings are drawn for keys which are not explicitly mapped. By default layers do not have a parent, that is, unmapped keys will have no effect. A parent is specified by appending :<parent> to the layer name. The layout is a special layer from which mappings are drawn if no other layers are active. The default layout is called main and is the one to which mappings are assigned if no layer heading is present. By default all keys are defined as themselves in the main layer. Layouts should inherit from main to avoid having to explicitly define each key. The default layout can be changed by including layout(<layer>) at the top of the config file. The Modifier Layoutkeyd distinguishes between the key layout and the modifier layout. This allows the user to use a different letter arrangement for modifiers. It may, for example, be desireable to use an alternative key layout like dvorak while preserving standard qwerty modifier shortcuts. This can be achieved by passing a second argument to the layout function like so: layout(dvorak, main). The default behaviour is to assign the modifier layout to the key layout if one is not explicitly specified.Note that this is different from simply defining a custom layer which reassigns each key to a modified key sequence (e.g s = C-s) since it applies to all modifiers and preserves expected stacking behaviour. Modifier LayersIn addition to standard layers, keyd introduces the concept of `modifier layers' to accomodate the common use case of remapping a subset of modifier keys. A modifier layer will behave as a set of modifiers in all instances except when a key is explicitly mapped within it and can be defined by creating a layer which inherits from a valid modifier set.E.G:
Will cause the capslock key to behave as control in all instances except when C-1 is pressed, in which case the key sequence C-A-f1 will be emitted. This is not possible to achieve using standard layers without breaking expected behaviour like modifier stacking and pointer combos. Summary
ACTIONS
Where <macro> has the form <token1> [<token2>...] where each token is one of:
Examples:
EXAMPLESExample 1Set the default key layout to dvorak and the modifier layout to qwerty (main).
Example 2Make esc+q/w/e set the letter layout.
Example 3Invert the behaviour of the shift key without breaking modifier behaviour.
Example 4Tapping control once causes it to apply to the next key, tapping it twice activates it until it is pressed again, and holding it produces expected behaviour.
Example 5Meta behaves as normal except when tab is pressed after which the alt_tab layer is activated for the duration of the leftmeta keypress. Subsequent actuations of ` will thus produce A-S-tab instead of M-`.
AUTHORWritten by Raheman Vaiya (2017-).BUGSPlease file any bugs or feature requests at the following url:<https://github.com/rvaiya/keyd/issues> Visit the GSP FreeBSD Man Page Interface. |