4

I am using Keyboard Layouts Plugin to switch between two layouts.

I want to remap Caps Lock to underscore _.

First I empty Caps Lock, or otherwise Caps Lock will do both – toggle caps and produce underscore character and then map caps lock to underscore

xmodmap -e "keycode 66 = "
xmodmap -e "keycode 66 = underscore"

Problem? This resets every time I log out or change something in Keyboard Layouts Plugin preferences. I want this to be permanent.

Artur Meinild
  • 21,605
  • 21
  • 56
  • 89
  • See if this question helps: [How can I change what keys on my keyboard do?](http://askubuntu.com/questions/254424/how-can-i-change-what-keys-on-my-keyboard-do/254425#254425) – Aditya Apr 01 '13 at 10:44
  • @Aditya - I want to know how to remap a key permanently so that xfce doesn't reset it. That link does not address this issue. –  Apr 01 '13 at 11:14
  • Try the other suggestions given - `xbindkeys`, `xev`, etc along with `xmodmap`. I am sure they are written in a way that would bind the keys permanently. That question is pretty comprehensive. If you still face the issue, please update the question. – Aditya Apr 01 '13 at 11:17
  • @Aditya - `setxkbmap -option caps:underscore` <-- why doesn't this do anything? –  Apr 01 '13 at 11:54
  • I won't be able to help you on this. I have no idea about the stuff. Neither can I find that code (`setxkbmap -option`) in any of the answers to that question. I would suggest you to edit your question to include what problems you are facing. – Aditya Apr 01 '13 at 12:04
  • @Aditya - I think I said clearly that _Keyboard Layouts Plugin resets everything_ –  Apr 01 '13 at 12:10
  • My answer [for this question](http://askubuntu.com/questions/54157/how-do-i-set-xmodmap-on-login/211461#211461) might be helpful, especially regarding the situation in Xfce. –  Apr 01 '13 at 17:15

1 Answers1

0

You can use the remapper deamon keyd for this purpose. See this answer for installation, usage and tips.

Assuming you run a US layout, use this config:

[ids]

*

[main]

capslock = S-minus

This maps CapsLock to Shift-Minus, thus producing _.

Rasmus
  • 8,115
  • 11
  • 45
  • 72