LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Tags used in this thread
Popular LQ Tags , , , , , , ,

Reply
 
Thread Tools
Old 10-05-2007, 01:11 PM   #1
Ekardnam
LQ Newbie
 
Registered: Nov 2003
Location: Sweden
Distribution: Slackware
Posts: 27
Thanked: 0
Add a new modifier key


[Log in to get rid of this advertisement]
Got Compiz Fusion up and running today, sweet. Now I'm planning to dedicate the Caps Lock key to window management, thus turning it to a modifier key.

"Wait a minute", you say, "this has been answered like 10000 times before if not more!" And you are right, I apologize for brining such a common "trick"/question up again; I've search for a while, both here and using Google, but still haven't found a solution.

So what's the problem?

I don't want to switch keys or remap caps lock to an existing key. I want a new modifier key. Obviously, xmodmap is the answer. I ran it and got

Code:
hans@localhost:~$ xmodmap
xmodmap:  up to 3 keys per modifier, (keycodes in parentheses):

shift       Shift_L (0x32),  Shift_R (0x3e)
lock      
control     Control_L (0x25),  Control_R (0x6d)
mod1        Alt_L (0x40),  Alt_L (0x7d),  Meta_L (0x9c)
mod2        Num_Lock (0x4d)
mod3      
mod4        Super_L (0x7f),  Hyper_L (0x80)
mod5        Mode_switch (0x5d),  ISO_Level3_Shift (0x71),  ISO_Level3_Shift (0x7c)
After searching a while, I found Hyper_L. Using xev, I learned that the keycode of my caps lock key was 66.

Code:
xmodmap -e 'remove lock = Caps_Lock'
xmodmap -e 'keycode 66 = Hyper_L'
xmodmap -e 'add mod3 = Hyper_L'
Sure enough, when running xev again, it says keycode 66 (keysym 0xffed, Hyper_L). So far so good.

So why are you asking for help then?

Because, apparently, my applications don't like the new key. When trying to map a shortcut in KDE applications, it simply doesn't react when I press the caps lock key (which should have shown as "Hyper").

Better luck with CompizConfig Settings Manager (K version) then? Kind of. I can map actions to "Hyper+something", but when I press the combination, nothing happens.

That's how far I've gotten. It feels like I've made a stupid mistake somewhere, instead of trying for hours and finally realizing it I beg for your help instead.

If the Hyper key isn't any good, I've thought of another possible solution: map caps lock to <Control><Super><Shift><Alt>. Is that possible? So when I press the caps key, it's like pressing the four modifier keys, creating a "new" modifier key.

As always, thanks in advance.
Ekardnam is offline  
Tag This Post , , , , , , ,
Reply With Quote
Old 10-06-2007, 06:51 AM   #2
Electro
Guru
 
Registered: Jan 2002
Location: AZ
Distribution: Gentoo
Posts: 5,740
Thanked: 21
I think X Window System uses its own keymap which may change what you set in bash. If you are using Xorg 7.x, you can use custom key code option in your /etc/X11/xorg.conf file. Also you can place a file in your home directory, so KDE runs it when you log into it. I think KDM, a display manager, also provides a way to set custom key maps. Probably the xorg.conf way will be the best way.

I do not use KDE because it is too bloated, so check its documentation or ask a KDE developer.

Just remember, what you set in virtual terminal will not work for other programs. Every virtual terminal and every program that you run gets its own environment. Linux is a multi-task OS which means it runs many tasks with the same default environment that is separated by other programs.
Electro is offline     Reply With Quote
Old 10-06-2007, 04:38 PM   #3
Ekardnam
LQ Newbie
 
Registered: Nov 2003
Location: Sweden
Distribution: Slackware
Posts: 27
Thanked: 0

Original Poster
Quote:
Originally Posted by Electro View Post
I think X Window System uses its own keymap which may change what you set in bash. If you are using Xorg 7.x, you can use custom key code option in your /etc/X11/xorg.conf file.
Didn't find much info about it, do you know where I can find more (as in more relevant) information?

Quote:
Originally Posted by Electro View Post
Just remember, what you set in virtual terminal will not work for other programs.
Is that really the case with xmodmap? Because I have no problems remapping caps lock to other keys, such as escape.

Right now I wonder if it isn't a KDE issue; Hyper isn't listed as a modifier key under "KDE Modifiers". Does anyone know how to add it there?
Ekardnam is offline     Reply With Quote
Old 06-25-2009, 01:59 PM   #4
uni4dfx
LQ Newbie
 
Registered: Jun 2009
Posts: 5
Thanked: 0
I would also like to know this.
uni4dfx is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
X Utility to lock a modifier key down manually? enigma_0Z Linux - Desktop 0 10-06-2007 07:44 PM
XKeyEvent and the mode_switch (AltGr) modifier LonelyStar Programming 1 10-04-2007 02:35 PM
Win / Tux key no longer bound as a modifier in KDE 3.5 / FC 4 atarisan Linux - General 6 02-23-2006 06:24 PM
ssh-add key for windows hamish Linux - Networking 4 01-13-2005 08:43 PM
how to add PGP key to GnuPG or PGPKeyring " zameer_india Linux - Software 3 10-06-2004 12:21 AM


All times are GMT -5. The time now is 09:46 PM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration