Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I tried doing it like follows (in autostart):

setxkbmap -option "ctrl:nocaps"

and it works, but only for a while - then the setting is reset back to original state. How can I make it persistent?

I use xfce4-xkb-plugin as my input language switcher, but it doesn't seem to have an option to set caps key function.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Finally, I found what I was seeking for. The solution: remove xfce keyboard applet (didn't need to deinstall it, just deleting it from panel worked), install xxkb. Make sure the ~/.xxkbrc contents look something like this:

XXkb.mainwindow.geometry: 20x20+0+0
XXkb.mainwindow.label.background: black
XXkb.mainwindow.label.foreground: white
XXkb.mainwindow.label.font: -misc-*-r-*-14-*
XXkb.mainwindow.label.text.1: en
XXkb.mainwindow.label.text.2: ru
XXkb.controls.add_when_start: yes
XXkb.controls.two_state: no
XXkb.button.enable: no

And add the following to run at your session startup:

xxkb &
setxkbmap -layout us,<your layout> -option "grp:ctrl_shift_toggle,ctrl:nocaps"
share|improve this answer

The easiest is to create a file named ~/.gconf/desktop/gnome/peripherals/keyboard/kbd/%gconf.xml with the content:

<?xml version="1.0"?>
<gconf>
       <entry name="options" mtime="1360937304" type="list" ltype="string">
               <li type="string">
                       <stringvalue>ctrl       ctrl:swapcaps</stringvalue>
               </li>
       </entry>
</gconf>

If that file already exists, or if you prefer to do it the manual way using the GUI, click the settings cog in the top right corner, choose System Settings, then Keyboard Layout, click Options, expand Ctrl key position and choose Swap Ctrl and Caps Lock.

share|improve this answer
    
Unfortunately, it's Xfce, not Gnome. They don't have such option in Xfce :( –  Rogach Feb 23 '13 at 20:07
    
Oh, that is correct. My bad. –  holmb Feb 23 '13 at 20:08

Add the setxkbmap option in XKBOPTIONS in /etc/default/keyboard. That file is also when you run sudo dpkg-reconfigure keyboard-configuration, however running that command does not interactively let you choose to swap Caps Lock and Ctrl, so you will need to edit the file by hand.

share|improve this answer
    
I already tried that - nothing changed. –  Rogach Feb 23 '13 at 20:39
    
Are you seeing the same thing as this blogger did? tinkerplanet.com/2012/06/… –  holmb Feb 23 '13 at 20:40
    
Doesn't seem so. Let me try again, I'll post the detailed symptoms of what happens when I try setting XKBOPTIONS. –  Rogach Feb 23 '13 at 20:44
    
So, I added option, ran dpkg-reconfigure. At first, everything is great, but I lost the ability to change keyboard layout (it was deleted from layouts list). I go to keyboard applet (xfce4-xkb-plugin), set up new layout, set the key combination to change the layout (left ctrl + left shift). Now, language change works - but caps lock is back to original function. –  Rogach Feb 23 '13 at 20:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.