LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-17-2010, 12:53 PM   #1
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Arch Linux
Posts: 97

Rep: Reputation: 1
Red face Remapping Caps Lock to Shift


Hi I want to remap the Capslock key to a Shift key. The reason being is the UK keyboard has a very large Caps Lock and a alpha size shift.
I have been looking everywhere and there is a lot about turning it into a CTRL key but I don't understand.

Can you give me simple instuctions I don't know what keycodes to use and what file to edit.
Tried the Ubuntu forum but no answer there.
Bob...
Distro Ubuntu 10.10
 
Old 11-17-2010, 01:41 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,565

Rep: Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696
There's a file called .Xmodmap or provision for one in most X installs.

You find your keymap, and alter it. The basic format is for the xmodmap command (man xmodmap). The syntax is aomething like

xmodmap key New_value_1 New_value_2 New_value_3 New_value_4

The four values are lowercase, Uppercase, and some other modifiers (some of Ctrl, Alt, Alt_gr & shift)

In playing with alt & shift, they themselves are modifiers, so what you are attempting is not simple. I suggest following the motto: "If at first you don't succeed, give up!"
 
Old 11-17-2010, 02:54 PM   #3
Bob Fletcher
Member
 
Registered: Nov 2008
Location: Hinckley UK
Distribution: Arch Linux
Posts: 97

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by business_kid View Post
There's a file called .Xmodmap or provision for one in most X installs.

You find your keymap, and alter it. The basic format is for the xmodmap command (man xmodmap). The syntax is aomething like

xmodmap key New_value_1 New_value_2 New_value_3 New_value_4

The four values are lowercase, Uppercase, and some other modifiers (some of Ctrl, Alt, Alt_gr & shift)

In playing with alt & shift, they themselves are modifiers, so what you are attempting is not simple. I suggest following the motto: "If at first you don't succeed, give up!"
Thanks, can you give me the location of .xmodmap and what do I put or modify in it?
Thanks
 
Old 11-18-2010, 03:47 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,565

Rep: Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696
locate xinitrc. It's usually in the same directory. I can't tell you what to put in it - I think you need to start reading.
 
Old 11-18-2010, 04:19 AM   #5
MrCode
Member
 
Registered: Aug 2009
Location: Oregon, USA
Distribution: Arch
Posts: 864
Blog Entries: 31

Rep: Reputation: 148Reputation: 148
I set up my Compose key using xmodmap by putting the following in my .xinitrc:

Code:
xmodmap -e "keycode 108 = Multi_key"
Sure it's probably redundant, in a way (it does the mapping "manually" with each X restart; I don't have a .xmodmap file), but it works for me.

You should be able to do something similar with yours. You can get the keycode for your caps lock key by running "xev" in an X terminal and hitting the key. For me the output is the following:

Code:
KeyPress event, serial 36, synthetic NO, window 0x2c00001,
    root 0x15e, subw 0x0, time 80167661, (34,-6), root:(1076,260),
    state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x2c00001,
    root 0x15e, subw 0x0, time 80167806, (34,-6), root:(1076,260),
    state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
So keycode 66 would be the Caps Lock key.

Last edited by MrCode; 11-18-2010 at 04:22 AM.
 
Old 12-06-2010, 05:52 AM   #6
Oeconomist
LQ Newbie
 
Registered: Dec 2010
Distribution: RHEL 6.0
Posts: 2

Rep: Reputation: 0
To effect the change for all users, add the following to /etc/X11/Xmodmap
remove Lock = Caps_Lock
add Shift = Caps_Lock
To effect the change for a single account, crešte or edit a file ~/.Xmodmap or ~/.xmodmap, to include those two lines, and crešte or edit a file ~/.xsession (or, for some distributions, ~/.xsessionrc or ~/.xinitrc) to ensure that it contains
xmodmap ~/.Xmodmap
or
xmodmap ~/.xmodmap
(depending upon which of those now exists and contains the aforenoted two lines).

Once you have restarted X, the CapsLock key should be a Shift key.

To effect the change just for the immediate session, enter
xmodmap -e "remove Lock = Caps_Lock"
xmodmap -e "add Shift = Caps_Lock"

Last edited by Oeconomist; 12-06-2010 at 05:57 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shift/Caps lock key sometimes broken - old bug? mostlyharmless Slackware 3 12-23-2009 07:58 PM
Num lock OFF and Caps & Screen Lock ON at Linux startup. Reversing? peteyperson Linux - Newbie 2 02-28-2009 12:44 PM
all software installs hang scroll lock and caps lock lights flash jcorrnt Linux - Hardware 6 02-07-2009 01:44 PM
Caps lock remapping into an "alt Gr lock"? aleksanteri Linux - General 1 08-26-2008 04:58 PM
remapping caps lock as multikey Ryzol Linux - General 2 11-01-2007 05:43 PM


All times are GMT -5. The time now is 04:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration