How To Reload xserver After a Change in Keyboard Layout

keyboard-layoutx-server

I do a change in my current keyboard layout English(US-Dvorak) but it does not react with the following code without changing back-and-forth to another keyboard layout, for xserver reloading

# restore your current keyboard settings; 
sudo apt-get install --reinstall xkb-data
# you close also extra Control at Capslock etc
gsettings set org.gnome.desktop.input-sources xkb-options "[]"

# do any change in `/usr/share/X11/xkb/symbols/us`; etc add about 3rd level config for some [A,a] like [A,a,x]. 

sudo dpkg-reconfigure xkb-data

# TODO Is there any command which can cause reload of xserver regardless you have active your current keyboard where you do the change?

I do not want to manually cause the reloading of xserver by doing such a switch. It would be great to do by a one-liner.

Systems: Ubuntu 16.04
Linux kernel: 4.6
Keyboard model: pc105
Keyboard layout: English (Dvorak) = US-dvorak
Related thread: here about How to Get A with Dots in Dvorak of Ubuntu 16.04?

Best Answer

From here:

To apply new [keyboard] settings, restarting the keyboard-setup service should suffice, otherwise you can try to restart kernel input system via udev:

udevadm trigger --subsystem-match=input --action=change

For completeness, restarting keyboard-setup would look like

# For Ubuntu < 16.04
service keyboard-setup restart
# For Ubuntu >= 16.04
systemctl restart keyboard-setup
Related Question