2

I'm having the hardest time trying to understand how xmodmap works. I want to remap the Caps Lock key to Control.

In an attempt to emaulate the answers shown here, I created the file .xmodmaprc:

clear Lock
keycode 65 = Control_L 
# I got the value 65 from running xev and pressing the key.

Then I added the following to .kshrc:

export XMODMAPRC="/Home/username/.xmodmaprc"
[ -f $XMODMAPRC ] && echo "OK" && xmodmap $XMODMAPRC

When I launch a new xterm, I can see the "OK" printed at login, but the key is still behaving as a Caps Lock!

How can I make this work?

I work on Solaris 10 and I don't have root access.

2
  • 1
    Not .kshrc, but your X session startup script. I don't know what that is for Solaris 10. Oct 31, 2012 at 22:09
  • I finally got it. I'm accessing a Solaris server from a Windows host and I run X locally. It was Exceed that needed remapping. X's notion of server/client is confusing. Here's how to do it on Exceed. @Gilles thanks for your comment, it led me in the right direction.
    – rahmu
    Nov 22, 2012 at 21:47

1 Answer 1

3

This works for me; it swaps the Caps Lock and left Control keys.

#!/bin/sh

xmodmap - <<EOF
remove Lock = Caps_Lock
remove Control = Control_L
keysym Control_L = Caps_Lock
keysym Caps_Lock = Control_L
add Lock = Control_L
add Control = Control_L
EOF

If you want both keys to act as Control keys, you'll have to modify this; I frankly don't understand xmodmap well enough myself to do so, but this should be a good starting point.

2
  • It doesn't work. Did you try it on Solaris? Maybe I'm doing something wrong...
    – rahmu
    Jan 24, 2012 at 10:33
  • Sorry, I haven't tried it on Solaris, and I don't have access to a Solaris X server. Ubuntu (Linux) lets you remap the control key through the preferences GUI; does Solaris have something similar? Jan 24, 2012 at 10:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .