i3status_rs::blocks

Module keyboard_layout

Source
Expand description

Keyboard layout indicator

Six drivers are available:

  • xkbevent which can read asynchronous updates from the x11 events
  • setxkbmap (alias for xkbevent) DEPRECATED
  • xkbswitch (alias for xkbevent) DEPRECATED
  • localebus which can read asynchronous updates from the systemd org.freedesktop.locale1 D-Bus path
  • kbddbus which uses kbdd to monitor per-window layout changes via DBus
  • sway which can read asynchronous updates from the sway IPC

setxkbmap and xkbswitch are deprecated and will be removed in v0.35.0.

Which of these methods is appropriate will depend on your system setup.

§Configuration

KeyValuesDefault
driverOne of "xkbevent", "setxkbmap", "xkbswitch", "localebus", "kbddbus" or "sway", depending on your system."xkbevent"
interval DEPRECATEDUpdate interval, in seconds. Only used by the "setxkbmap" driver.60
formatA string to customise the output of this block. See below for available placeholders." $layout "
sway_kb_identifierIdentifier of the device you want to monitor, as found in the output of swaymsg -t get_inputs.Defaults to first input found
mappingsMap layout (variant) to custom short name.None

interval is deprecated and will be removed in v0.35.0.

KeyValueType
layoutKeyboard layout nameString
variantKeyboard variant name or N/A if not applicableString

§Examples

Listen to D-Bus for changes:

[[block]]
block = "keyboard_layout"
driver = "localebus"

Listen to kbdd for changes, the text is in the following format: “English (US)” - {$layout ($variant)} use block.mappings to override with shorter names as shown below. Also use format = “ $layout ($variant) “ to see the full text to map, or you can use: dbus-monitor interface=ru.gentoo.kbdd to see the exact variant spelling

[[block]]
block = "keyboard_layout"
driver = "kbddbus"
[block.mappings]
"English (US)" = "us"
"Bulgarian (new phonetic)" = "bg"

Listen to sway for changes:

[[block]]
block = "keyboard_layout"
driver = "sway"
sway_kb_identifier = "1133:49706:Gaming_Keyboard_G110"

Listen to sway for changes and override mappings:

[[block]]
block = "keyboard_layout"
driver = "sway"
format = " $layout "
[block.mappings]
"English (Workman)" = "EN"
"Russian (N/A)" = "RU"

Listen to xkb events for changes:

[[block]]
block = "keyboard_layout"
driver = "xkbevent"

Structs§

Enums§

Functions§