7

I'm a bit confused regarding the difference/relationship between localectl and setxkbmap. Is any of them meant to supersede the other? Or are they meant to be used in conjunction? Are they even changing the same settings?!

For instance here's my localectl output

--> localectl status
   System Locale: LANG=en_US.UTF-8
       VC Keymap: us
      X11 Layout: us
       X11 Model: pc105+inet
     X11 Options: terminate:ctrl_alt_bksp

Which indicates that I only have the us layout, but in fact I have used setxkbmap to install another layout

--> setxkbmap -query
rules:      evdev
model:      pc105+inet
layout:     us,ar
variant:    ,mac
options:    grp:alt_shift_toggle,caps:escape,terminate:ctrl_alt_bksp
0xcurb
  • 71
  • 2

2 Answers2

3

localect changes the settings that should be used in programs (including Xorg server) started after, while setxkbmap changes keyboard options for the currently running Xorg server. Also setxkbmap allows more fine-grained control, and allows switching between varios layouts during runtime.

Tomasz Pala
  • 229
  • 1
  • 6
1

Quoting the arch wiki:

setxkbmap sets the keyboard layout for the current X session only, but can be made persistent in xinitrc or xprofile. This overrides system-wide configuration specified following Using X configuration files.

and

For convenience, the tool localectl may be used instead of manually editing X configuration files. It will save the configuration in /etc/X11/xorg.conf.d/00-keyboard.conf, this file should not be manually edited, because localectl will overwrite the changes on next start.

So setxkbmap overrides the configuration specified by localectl

lucidbrot
  • 488
  • 1
  • 6
  • 21