keyd(1)

πŸ“¦
version 2.6.0 Β· 3 versions
, in arch rolling, nixos 26.05, nixpkgs unstable

✨ NAME ✨

okay so this is the keyd(1) page, straight out of the General Commands Manual β€” and it's about keyd, which is a key remapping daemon. that's the whole entire vibe bestie πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

keyd [command] [options]

like, you run keyd, you maybe give it a command, you maybe give it options. iconic behavior tbh πŸ’–


🫢 COMMANDS 🫢

  • monitor [-t] β€” prints key events for you. and if you pass -t, it also prints the time since the last event in ms. so useful for discovering key names/device ids and for debugging. literally the glow-up tool for figuring out what your keyboard is even doing πŸ”βœ¨
  • listen β€” prints layer state changes of the running keyd daemon to stdout. useful for scripting. no cap, this one's for the automation girlies πŸŽ€
  • bind reset|<binding> [<binding>...] β€” applies the bindings you supply. see Bindings for the details, iykyk.
  • reload β€” reloads the config files. that's it. that's the whole thing 🧚
  • list-keys β€” lists all the valid key names. your cheat sheet fr fr πŸ“‹
  • input [-t <timeout>] <text> [<text>...] β€” inputs the text you give it. if you give it no arguments, it reads the input from STDIN instead. a timeout in microseconds may optionally be supplied, and that corresponds to the time between emitted events. fancy πŸ’«
  • do [-t <timeout>] [<exp>] β€” executes the expression you hand it. see MACROS for the format of <exp>. if no arguments are given, the expression gets read from STDIN. and if supplied, <timeout> corresponds to the macro_sequence_timeout. she's doing the most and we love her πŸ”₯
  • check [<config file>...] β€” validates the config files you supply. if you supply no files, then all the files in the config directory get checked. this exits with a non-zero return code if and only if any files fail validation. so like, a clean exit means you're slaying, a non-zero means something's busted πŸ’€

πŸ’… OPTIONS πŸ’…

  • -v, --version β€” print the current version and exit.
  • -h, --help β€” print help and exit.

short, sweet, to the point. periodt.


πŸ‘‘ DESCRIPTION πŸ‘‘

keyd is a system wide key remapping daemon, and she supports features like layering, oneshot modifiers, and macros. in its most basic form it can be used to define a custom key layout that persists across display server boundaries β€” like across wayland/X/tty πŸ–₯οΈπŸ’–

the program runs in the foreground, printing diagnostic information to the standard output streams, and it's intended to be run as a single instance managed by the init system. one daemon, one main character ✨

NOTE: 😭 bestie please read this one. because keyd modifies your primary input device, it is possible to render your machine unusable with a bad config file. if you find yourself in this situation, the panic sequence backspace+escape+enter will force keyd to terminate. memorize it. tattoo it on your brain. you're welcome 🫢

πŸŽ€ CONFIGURATION πŸŽ€

configuration files loosely follow an INI style format, consisting of headers of the form [section_name] followed by a set of bindings. lines beginning with a hash are ignored. (yes, the classics πŸ’…)

config files are stored in /etc/keyd/ and they get loaded upon initialization. the reload command can be used to update the working set of config files β€” e.g. sudo keyd reload. πŸ§šβ€β™€οΈ

a valid config file has the extension .conf and it must begin with an [ids] section that has one of the following forms:

[ids]

<id 1 (obtained via keyd monitor)>
<id 2>
...

or

[ids]

*
-<id 1>
-<id 2>
...

the first form specifies a list of ids to be explicitly matched, while the second one matches any id which has not been explicitly excluded. two flavors, both valid, choose your fighter 🌸

for example:

[ids]
*
-0123:4567

will match all keyboards which do not^[(2)] have the id 0123:4567, while:

[ids]

0123:4567

will exclusively match any devices which do. device ids can be obtained from the monitor command (see COMMANDS). note that a device id may only be listed in a single config file. 🚨 one file only. don't be greedy. 🚨

each subsequent section of the file corresponds to a layer β€” with the exception of [global] (see GLOBALS).

config errors will appear in the log output and can be accessed in the usual way using your system's service manager (e.g. sudo journalctl -eu keyd). that's your vibe check when things go weird πŸ”

if an id matches more than one device type, the prefix k: may be used to exclusively match keyboards, and the prefix m: may be used to exclusively match mice. (e.g. m:046d:b01d) 🐭

Note: all keyboards defined within a given config file will share the same state. this is useful for linking separate input devices together (e.g. foot pedals). cute!! 🦢
Note 2: the wildcard will only match devices which keyd identifies as keyboards. keyd is also capable of managing mice (e.g. to facilitate clearing of oneshot modifiers on click), but their ids must be explicitly listed. no wildcard shortcut for the mice bestie πŸ™ˆ
Note 3: ⚠️ mouse support is currently experimental, and is mostly confined to traditional mice (e.g. touchpads). adding some mice to your ids section may break your pointer. it may also be necessary to explicitly blacklist mice which are misidentified as keyboards (e.g. if you find your moused misbehaving). proceed with caution, she's fragile πŸ’€

🌈 Layers 🌈

a layer is a collection of bindings, each of which specifies the behaviour of a particular key. multiple layers may be active at any given time, forming a stack of occluding keymaps consulted in activation order. the default layer is called main, and that's where common bindings should be defined. like, that's home base 🏠

for example, the following config snippet defines a layer called nav and creates a toggle for it in the main layer:

[main]

capslock = layer(nav)

[nav]

h = left
k = up
j = down
l = right

when capslock is held, the nav layer occludes the main layer, causing hjkl to function as the corresponding arrow keys. it's giving vim brainrot and honestly? we stan 🧠✨

unlike most other remapping tools, keyd provides first class support for modifiers. a layer name may optionally end with a ':' followed by a set of modifiers to emulate in the absence of an explicit mapping. layer names may consist of a maximum of 64 characters (including all modifiers). yes, sixty-four. don't push it πŸ’…

these layers play nicely with other modifiers and preserve existing stacking semantics. polite queen πŸ‘‘

for example:

[main]

capslock = layer(capslock)

[capslock:C]

j = down

will cause capslock to behave as control, except in the case of capslock+j, which will emit down. this makes it trivial to define custom modifiers which don't interfere with one another. genuinely so clean πŸ˜­πŸ’–

note that bindings are not affected by the modifiers of the layer in which they are defined. thus capslock+j will produce an unmodified down keypress, while shift+capslock+j will produce shift+down as expected. see? it just works. πŸ”₯

formally, each layer heading has the following form:

"[" <layer name>[:<modifier set>] "]"

where <modifier_set> has the form:

<modifier1>[-<modifier2>]...

and each modifier is one of:

  • C β€” Control
  • M β€” Meta/Super
  • A β€” Alt
  • S β€” Shift
  • G β€” AltGr

finally, each layer heading is followed by a set of bindings which take the form:

<key> | <alias> = <key>|<macro>|<action>

for a description of <action> and <macro>, see ACTIONS and MACROS. ✨

by default, each key is bound to itself within the main layer. the exception to this are the modifier keys, which are instead bound to eponymously named layers with the corresponding modifiers. so meta is meta-ing, you know? πŸ’…

for example, meta is actually bound to layer(meta), where meta is internally defined as meta:M.

the full set of modifier bindings are as follows:

control = layer(control)
meta = layer(meta)
shift = layer(shift)
leftalt = layer(alt)
rightalt = layer(altgr)

a consequence of this is that overriding modifier keys is a simple matter of adding the desired bindings to an appropriate pre-defined layer. easy slay ✨

thus

[ids]
*

[control]
j = down

is a completely valid config, which does what the benighted user might expect. internally, the full config actually looks something like this:

[ids]
*

[main]
leftcontrol = layer(control)
rightcontrol = layer(control)

[control:C]
j = down

like, she expands. she's generous. 🫢

if multiple bindings for the same key are present, the most recent one takes precedence. last one wins, no cap.

a layer heading may also appear multiple times, in which case the layer will contain the sum of all bindings. note that the layer type may not be reassigned. 🚫

that is:

[mylayer:A]
a = b
c = d

[mylayer:C]
a = x
b = c

is equivalent to:

[mylayer:A]
a = x
b = c
c = d

see how a and b got overwritten but c = d survived? merging, but make it fashion πŸ’–


πŸ¦‹ Composite Layers πŸ¦‹

a special kind of layer called a composite layer can be defined by creating a layer with a name consisting of existing layers delimited by +. the resultant layer will be activated and given precedence when all of its constituents are activated. composite layers are not allowed to have modifiers attached and cannot be explicitly assigned. rules are rules bestie πŸ’…

e.g.

[control+alt]
h = left

will cause the sequence control+alt+h to produce left (ignoring the control and alt modifiers attached to the active control and alt layers), while pressing control+alt+f1 preserves those modifiers, emitting exactly what was pressed, as there is no explicit binding for f1 on the composite layer. so it only changes what you told it to change. respectful icon 🌸

[main]
capslock = layer(capslock)

[capslock:C]

[capslock+shift]
h = left

will cause the sequence capslock+shift+h to produce left, while preserving the expected functionality of capslock and shift in isolation. chef's kiss πŸ˜™πŸ‘Œ

Note: composite layers must always be defined after the layers of which they are comprised. order matters, bestie!!

that is:

[layer1]
[layer2]
[layer1+layer2]

and not

[layer1+layer2]
[layer1]
[layer2]

don't do the second one. she will not know what you mean πŸ’€


πŸŽ€ Layouts πŸŽ€

a layout is a special kind of layer intended for modifying alpha keys. unlike layers, layouts cannot have any associated modifiers, and only one layout may be active at a given time. the default layout is called 'main', and it can be changed using the setlayout() action. one at a time, she's monogamous πŸ’…

for convenience, keyd ships with a number of common letter layouts in /usr/share/keyd/layouts. before including these, it is instructive to inspect them. non-english layouts include a dedicated shift layer (making order of inclusion important) and require the use of keyd's compose definitions (see Unicode Support). so like, actually look before you leap 🧐

e.g.

# Include the shipped colemak layout.
include layouts/colemak

[global]
default_layout = mylayout

[mylayout:layout]
a = b
b = c
#etc...

[control]
1 = setlayout(customlayout)
2 = setlayout(colemak)

look at her go. layouts on layouts πŸ¦‹βœ¨


πŸ“ Chording πŸ“

chords are groups of keys which are treated as a unit when simultaneously depressed. a chord can be defined by using a group of + delimited key names as a left hand value. the corresponding action will be activated if all keys are struck within the chording interval (chord_timeout). synchronized slaying 🀝

e.g.

j+k = esc

will cause esc to be produced if both j and k are simultaneously depressed. press both, get one. teamwork makes the dream work fr fr πŸ’–

⚠️ Quick note from part 1: it may be desirable to change the default chording interval (50ms) to account for the physical characteristics of your keyboard. πŸ‘€ Like fr, tune it to your fingers.

🌈 Unicode Support

Okay so this is the fun part ✨ β€” if keyd encounters a valid UTF8 sequence as a right hand value, it will try and translate that sequence into a macro which emits a keyd-specific XKB sequence. It's giving typography main character energy πŸ’….

For this to actually work, the sequences defined in the compose file shipped with keyd (/usr/share/keyd/keyd.compose) must be accessible. You can do this globally by copying the file to the appropriate location in /usr/share/X11/locale, or on a per-user basis by symlinking it to ~/.XCompose. 🫢

E.g.

ln -s /usr/share/keyd/keyd.compose ~/.XCompose

Additionally you will need to be using the default US layout on your display server. Users of non-english layouts are advised to set their layout within keyd (see Layouts) to avoid conflicts between the display server layout and keyd's unicode functionality. No cap, this one matters πŸ’€.

Note: You may have to restart your applications for this to take effect. Yeah, the classic "have you tried turning it off and on again" πŸŽ€
Note 2: The generated compose sequences are affected by modifiers in the normal way. If you want shift to produce a different symbol, you will need to define a custom shift layer (see the included layout files for an example). πŸ‘‘
Note 3: GTK4 currently has a bug which causes it to crash in the presence of large XCompose files (like /usr/share/keyd/keyd.compose). Not us, not our problem, but like… be aware bestie 😭

πŸŽ€ Aliases

Each key may optionally be assigned an alias. This alias may be used in place of the key as a valid left hand value. Multiple keys may be bound to the same alias, but only one alias may be assigned to a key at a given time. So it's like a group chat β€” many members, but you only get one nickname per person πŸ’–.

For example, the keys leftmeta and rightmeta are bound to the alias meta by default. Thus the binding meta = a is equivalent to the bindings leftmeta = a and rightmeta = a. Slay, two-for-one πŸ“.

Aliases are defined in a special section called aliases where each line takes the form:

<key> = <name>

where <key> must be a valid key name. Periodt.

Note that <name> may itself be a valid key name, in which case all references to the key within the config file will be replaced with the new key. Additionally, if the assigned alias is a valid key name, the corresponding keycode will be assigned to the key by default. This makes it possible to redefine keys before any bindings are applied and is particularly useful in conjunction with the include mechanism to account for variations in hardware. Literally so useful πŸ¦‹.

For example:

/etc/keyd/common:
     meta = oneshot(meta)
     alt = oneshot(alt)

     a = a
     s = o
     # etc..

/etc/keyd/default.conf:
     [ids]
     *

     [main]
     include common

/etc/keyd/magic_keyboard.conf:
     [ids]
     004c:0267

     [aliases]
     leftalt = meta
     rightalt = meta
     rightmeta = alt
     leftmeta = alt

     [main]
     include common

Allows the user to define a set of universal bindings in /etc/keyd/common without having to explicitly account for the transposed meta and alt keys within the included config snippet. Chef's kiss πŸ‘¨β€πŸ³πŸ’‹ I mean πŸ’….

πŸ¦‹ File Inclusion

Config files may include other files located within the config directory using the include keyword. A line of the form include <file> may appear at any point after the [ids] section. The resultant config will behave as though the contents of the included file appear in place of the include statement. It's giving clone stamp tool 🌸.

Making strategic use of these statements makes it possible to share common functionality between configs. DRY vibes only, bestie ✨.

Include paths are relative and must be placed in one of the following directories:

  • /etc/keyd/
  • /usr/share/keyd/

E.g.

/etc/keyd/default.conf:
     [ids]
     *

     # Add our shared custom bindings.
     include common

     # Appends bindings to the main layer
     # defined in /etc/keyd/common (order matters)
     [main]
     capslock = layer(capslock)

     [capslock]
     1 = setlayout(colemak)
     2 = setlayout(dvorak)

/etc/keyd/common:
     [main]

     rightmeta = layer(nav)

     [nav]

     h = left
     j = down
     k = up
     l = right

/usr/share/keyd/layouts/dvorak:
     a = a
     s = o
     ...

Limitations β€” read these before you come for us πŸ™ˆ:

  • All include statements should appear after the [ids] section in the including file.
  • Included files should not contain an ids section.
  • Included files should not include other files (inclusion is non-recursive).
  • Included files should not end in .conf.

✨ GLOBALS ✨

A special section called [global] may be defined in the file and can contain any of the following options. This is where you do your global settings moment πŸ‘‘

  • macro_timeout β€” The time (in milliseconds) separating the initial execution of a macro sequence and the first repetition. (default: 600)
  • macro_repeat_timeout β€” The time separating successive executions of a macro. (default: 50)
  • layer_indicator β€” If set, this will turn the capslock light on whenever a layer is active. > Note: Some wayland compositors will aggressively toggle LED state rendering this option unusable. (default: 0) πŸ’€
  • macro_sequence_timeout β€” If set, this will add a timeout (in microseconds) between each emitted key in a macro sequence. This is useful to avoid overflowing the input buffer on some systems. 🧚
  • chord_timeout β€” The maximum time between successive keys interpreted as part of a chord. (default: 50)
  • chord_hold_timeout β€” The length of time a chord must be held before being activated. (default: 0)
  • oneshot_timeout β€” If non-zero, timeout a oneshot layer activation after the supplied number of milliseconds. (default: 0)
  • disable_modifier_guard β€” By default, keyd will inject additional control keypresses where necessary in order to prevent programs from seeing additional modifier taps (E.g alt in firefox). If set, this option disables that behaviour. (default: 0)
  • overload_tap_timeout β€” If non-zero, ignore the tap behaviour of an overloaded key if it is held for the given number of miliseconds. (default: 0).
Note: Unicode characters and key sequences are treated as macros, and are consequently affected by the corresponding timeout options. Lowkey important, don't forget it πŸŽ€

πŸ”₯ MACROS πŸ”₯

Various keyd actions accept macro expressions. This is where the real magic happens, iykyk 🌟

A macro expression has one of the following forms:

  1. macro(<exp>)
  2. [<modifier 1>[-<modifier 2>...]-<key>
  3. <char>

Where <char> is a valid unicode character and <exp> has the form <token1> [<token2>...] and each token is one of:

  • A valid key code.
  • A type 2 macro.
  • A contiguous group of unicode characters.
  • A group of key codes delimited by + to be depressed as a unit.
  • A timeout of the form <time>ms (where <time> < 1024).

The following are all valid macro expressions β€” vibe check passed βœ…:

  • C-a
  • macro(C-a)
  • macro(leftcontrol+leftmeta) # simultaneously taps the left meta and left control keys
  • A-M-x
  • macro(Hello space World)
  • macro(h e l l o space w o r ld) (identical to the above)
  • macro(C-t 100ms google.com enter)

Splitting into smaller tokens serves as an escaping mechanism: macro(space) inserts a space but macro(s pace) writes "space". Likewise, macro(3+5) depresses the 3 and 5 keys as a unit while macro(3 + 5) writes "3+5". It's giving spaces matter bestie πŸ˜­πŸ’–

Some prerequisites are needed for non-ASCII characters to work, see Unicode Support. πŸ¦‹

πŸ’₯ ACTIONS πŸ’₯

Okay so a key may optionally be bound to an action, and that action accepts zero or more arguments. Think of actions as little spells you attach to keys. ✨

  • layer(<layer>) β€” activates the given layer for the duration of the keypress. πŸ’…
  • oneshot(<layer>) β€” if tapped, activates the supplied layer for the duration of the next keypress. 🫢
  • swap(<layer>) β€” swaps the currently active layer with the supplied one. If the current layer is toggled, it is deactivated and the supplied layer is toggled instead. Otherwise, the active layer is deactivated and the supplied layer remains active for the duration of the depression of the activating key. The behaviour of this action is undefined for composite layers. 😭

Example config, exactly as the page gives it:

[control]

x = swap(xlayer)

[xlayer]

s = C-s
b = S-insert
⚠️ NOTE: You probably don't need to use this unless you are trying to do something quite involved. Think hard about whether or not what you are trying to achieve can be done by other means, as it is easy to end up in states which are impossible to exit. πŸ’€
  • setlayout(<layout>) β€” sets the current layout. 🌈
  • clear() β€” clears any toggled or oneshot layers. 🧚
  • toggle(<layer>) β€” permanently toggles the state of the given layer. πŸ‘‘
  • layerm(<layer>, <macro>) β€” identical to layer, but executes the supplied macro before the layer change. ✨
  • oneshotm(<layer>, <macro>) β€” identical to oneshot, but executes the supplied macro before the layer change. πŸŽ€
  • oneshotk(<layer>, <key>) β€” identical to oneshot, but also functions as the supplied key while held. This is mainly useful for temporarily altering the behaviour of immediately successive letter keys. πŸ¦‹
  • swapm(<layer>, <macro>) β€” identical to swap, but accepts a macro to be executed immediately after the layer change. πŸ’«
  • togglem(<layer>, <macro>) β€” equivalent to toggle, but additionally executes the supplied macro before toggling the layer. 🌸
  • clearm(<macro>) β€” identical to clear, but executes the supplied macro before clearing layers. πŸ’œ
  • repeat() β€” repeats the last key or macro sequence. πŸ”

πŸŽ€ Key overloading πŸŽ€

  • overload(<layer>, <action>) β€” activates the given layer while held and executes <action> on tap. ✨
  • overloadt(<layer>, <action>, <timeout>) β€” identical to overload, but only activates the layer if the bound key is held for <timeout> milliseconds. This is mainly useful for overloading keys which are commonly struck in sequence (e.g letter keys). πŸ“
Note that this will add a visual delay when typing, since overlapping keys will be queued until the timeout expires or the bound key is released. 😭
  • overloadt2(<layer>, <action>, <timeout>) β€” identical to overloadt, but additionally resolves as a hold in the event of an intervening key tap. πŸ’…
  • overloadi(<action 1>, <action 2>, <idle timeout>) β€” activates <action 1> if the last non-action (i.e symbol) key was struck less than <timeout> milliseconds ago, otherwise activate <action 2>. 🫢

This can be used in combination with other overload timeouts and is particularly useful for overloading letter keys (often called 'homerow mods').

For example:

a = overloadi(a, overloadt2(control, a, 200), 150)

will produce a if and only if:

  • a is struck within 150ms of another non-action key.
  • a is struck more than 150ms after the last non-action key but held for less than 200ms and there are no intervening key taps.

This reduces the visual latency by immediately resolving the key as a letter when typed midword, but also facilitates its use as a layer trigger if it is held for a long enough period with no intervening symbols. ⭐

Since this is a common usecase, a macro called lettermod (defined below) has been defined to facilitate such definitions. πŸ’–

  • lettermod(<layer>, <key>, <idle timeout>, <hold timeout>) β€” an alias for:
overloadi(<key>, overloadt2(<layer>, <key>, <hold timeout>),
<idle timeout>)
  • timeout(<action 1>, <timeout>, <action 2>) β€” if no key events occur within <timeout> ms, execute <action1>, otherwise execute <action1>. πŸ’€
Yes, bestie, the source literally says <action1> both times. I am not fixing it. Not me being the messenger. πŸ™ˆ

E.g.

timeout(a, 500, layer(control))

Will cause the assigned key to behave as control if it is held for more than 500 ms without any keys being struck in the interval. πŸ•°οΈ

NOTE: This is an older option with numerous subtle implications. It is mainly intended to be used in combination with other actions to achieve things which are not otherwise possible. Most users will want to use one of overload functions for simple tap/hold behaviour. ✨
  • macro2(<timeout>, <repeat timeout>, <macro>) β€” creates a macro with the given timeout and repeat timeout. If a timeout value of 0 is used, macro repeat is disabled. πŸŽ€

Note that <macro> must be a valid macro expression.

E.g.

macro2(400, 50, macro(Hello space World))
macro2(120, 80, left)
  • command(<shell command>) β€” execute the given shell command. πŸ”₯

E.g.

command(brightness down)
NOTE: Commands are executed by the user running the keyd process (probably root), use this feature judiciously. 😳
  • noop β€” do nothing. Literally. πŸ’…

🫢 IPC 🫢

To facilitate extensibility, keyd employs a client-server model accessible through the use of -e. The keymap can thus be conceived of as a living entity that can be modified at run time. ✨

In addition to allowing the user to try new bindings on the fly, this enables the user to fully leverage keyd's expressive power from other programs without incurring a performance penalty. πŸš€

For instance, the user may use this functionality to write a script which alters the keymap when they switch between different tmux sessions. 🧚

The application remapping tool (keyd-application-mapper(1)) which ships with keyd is a good example of this. It is a small python script which performs event detection for the various display servers (e.g X/sway/gnome, etc) and feeds the desired mappings to the core using -e. πŸ¦‹

NOTE: Users with access to the keyd socket should be considered privileged (i.e assumed to have access to the entire system.). πŸ‘‘

πŸ“Ž Bindings πŸ“Ž

The bind command accepts one or more bindings, each of which must have the following form:

[<layer>.]<key> = <key>|<macro>|<action>

Where <layer> is the name of an (existing) layer in which the key is to be bound. 🌸

As a special case, the string "reset" may be used in place of a binding, in which case the current keymap will revert to its original state (all dynamically applied bindings will be dropped). πŸ’œ

Examples:

$ keyd bind '- = C-c'
$ keyd bind reset '+ = C-c' # Reset the keyboard before applying the '+' binding (drops the previous '-' binding)

By default expressions apply to the most recently active keyboard. ⌨️

🌈 EXAMPLES 🌈

✨ Example 1 ✨

Make esc+q toggle the dvorak letter layout.

[ids]
*

[main]
esc = layer(esc)

[dvorak]

a = a
s = o
...

[esc]

q = toggle(dvorak)

✨ Example 2 ✨

Invert the behaviour of the shift key without breaking modifier behaviour.

[ids]
*

[main]
1 = !
2 = @
3 = #
4 = $
5 = %
6 = ^
7 = &
8 = *
9 = (
0 = )

[shift]
0 = 0
1 = 1
2 = 2
3 = 3
4 = 4
5 = 5
6 = 6
7 = 7
8 = 8
9 = 9

✨ Example 3 ✨

Tapping 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.

[main]

control = oneshot(control)

[control]

control = toggle(control)

✨ Example 4 ✨

Meta behaves as normal except when </kbd> is pressed, after which the alt_tablayer is activated for the duration of theleftmetakeypress. Subsequent actuations will thus produceA-tabinstead ofM-`.

[meta]

` = swap(alt_tab, A-tab)

[alt_tab:A]

tab = A-S-tab
` = A-tab

✨ Example 5 ✨

Compose-key glyph time β€” the comments in this config explain the whole deal. πŸŽ€

# Uses the compose key functionality of the display server to generate
# international glyphs.  # For this to work 'setxkbmap -option  compose:menu'
# must be run after keyd has started (see NOTES).

# A list of sequences can be found in /usr/share/X11/locale/en_US.UTF-8/Compose
# on most systems.

[main]

rightalt = layer(dia)

[dia]

# Map o to ΓΆ
o = macro(compose o ")

# Map e to €
e = macro(compose c =)

✨ Example 6 ✨

Tapping both shift keys will activate capslock.

# Tapping both shift keys will activate capslock.

[shift]

leftshift = capslock
rightshift = capslock

✨ Example 7 ✨

Capslock will behave as control in all instances except when used in conjunction with 'h/j/k/l' in which case it will produce arrow keys. If tapped, it will function as escape.

[main]
capslock = overload(capslock, esc)
esc = capslock

[capslock:C]
h = left
k = up
j = down
l = right

✨ Example 8 ✨

Disables the esc and end keys.

[main]
esc = noop
end = noop

πŸ“ NOTES πŸ“

Since keyd creates a virtual input device, settings applied using higher level input tools like setxkbmap, xset may be lost when the daemon is (re)started. See https://github.com/rvaiya/keyd/issues/183 for details. 🫢

🌱 ENVIRONMENT VARIABLES 🌱

  • KEYD_DEBUG β€” Debug log level. 0,1,2 can be specified (default: 0). πŸ›

πŸ‘‘ AUTHOR πŸ‘‘

Written by Raheman Vaiya (2017-). πŸ’–

πŸ› BUGS πŸ›

Please file any bugs or feature requests at the following url:

https://github.com/rvaiya/keyd/issues

πŸ’– That's the whole keyd(1) page, bestie β€” the source/version is keyd(1), dated 2025-09-11. Go slay your keymap! πŸŽ€βœ¨

πŸ“¦ where this page comes from