Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setxkbmap setting lost when I switch keyboard layout in Ubuntu 16.04

I set my Caps Lock to be a Ctrl in Ubuntu 16.04 using: setxkbmap -option 'caps:ctrl_modifier' But when I change my keyboard from En to Cs, the Caps Lock becomes a Caps Lock again, not a Ctrl.

To fix it, I have to execute the above setxkbmap command again from a terminal.

How can I make the setting permanent, even if I switch keyboard layouts?

like image 964
Ondřej Čertík Avatar asked Oct 05 '16 15:10

Ondřej Čertík


1 Answers

In order to make the options set by setxkbmap permanent, add them to /etc/default/keyboard as follows:

--- a/etc/default/keyboard
+++ b/etc/default/keyboard
@@ -5,6 +5,6 @@
 XKBMODEL="pc105"
 XKBLAYOUT="us"
 XKBVARIANT=""
-XKBOPTIONS=""
+XKBOPTIONS="caps:ctrl_modifier"

 BACKSPACE="guess"

Then the option caps:ctrl_modifier will be set even when the keyboard layout is switched from En to any other language.

like image 118
Ondřej Čertík Avatar answered Oct 06 '22 01:10

Ondřej Čertík