Ubuntu – Ubuntu 18.04 – Kb layout xkb-options are ignored after reboot

18.04gnome-tweakskeyboard-layout

Using Tweaks to set keyboard layout works immediately. After reboot, although the settings I made are kept, Tweaks is ignored.

I find some solutions on the Internet, but all are related to older ubuntu versions(eg. soltion for older ubuntu versions). I can't find these files mentioned in these solutions on ubuntu 18.04.

[UPDATE]
The changes I made are in Keyboard & Mouse > Additional Layout Options > Alt/Win key behavior and Caps Lock behavior shown in the screenshot.

screenshot of options I chosen

The ls -al ~/.config/dconf command outputs:

total 24
drwx------  2 wen wen  4096 Aug 20 19:15 .
drwx------ 27 wen wen  4096 Aug 20 15:20 ..
-rw-r--r--  1 wen wen 13758 Aug 20 19:15 user

I tried cd ~/.config/dconf && mv user user.bak and reboot. Then the ls -al ~/.config/dconf command outputs:

total 32
drwx------  2 wen wen  4096 Oct 20 21:41 .
drwx------ 27 wen wen  4096 Aug 20 15:20 ..
-rw-r--r--  1 wen wen  4958 Oct 20 21:41 user
-rw-r--r--  1 wen wen 14064 Oct 20 21:25 user.bak

A new ~/.config/dconf/user file was created. It seems all settings were reset to default. So I used Tweaks to set again and it dose change the ~/.config/dconf/user file.

-rw-r--r--  1 wen wen  5084 Oct 20 21:47 user

Reboot again, the ls -al ~/.config/dconf command outputs:

total 32
drwx------  2 wen wen  4096 Oct 20 21:57 .
drwx------ 27 wen wen  4096 Aug 20 15:20 ..
-rw-r--r--  1 wen wen  5084 Oct 20 21:57 user
-rw-r--r--  1 wen wen 14064 Oct 20 21:25 user.bak

The gsettings get org.gnome.desktop.input-sources xkb-options command outputs:

['altwin:swap_alt_win', 'caps:ctrl_modifier']

The cat /etc/default/keyboard command outputs:

# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT=""
XKBOPTIONS=""

BACKSPACE="guess"

Best Answer

  • As a workaround you may want to try to edit the /etc/default/keyboard file and replace

    XKBOPTIONS=""
    

    with

    XKBOPTIONS="altwin:swap_alt_win,caps:ctrl_modifier"
    
  • Related Question