LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Search this Thread
Old 07-29-2014, 08:42 PM   #1
CVAlkan
Member
 
Registered: Nov 2012
Distribution: Ubuntu 14.04 LTS
Posts: 42

Rep: Reputation: Disabled
Mapping unused key as Super-key


I'm using a "real" keyboard from a few decades ago (a Northgate Omnikey Ultra) that has served me well through many PCs over the years but, as with all keyboards of that generation, it has no "super" ("Windows") key. It has an unused key that I would like to remap to serve as a "Super" Key, but none of the documentation I've located seems to apply to Ubuntu 14.04; indeed most of it refers to locations and utilities that don't exist in Ubuntu 14.04.

The key in question produces a keycode of 120 according to the following xev output:

KeyPress event, serial 37, synthetic NO, window 0x4000001,
root 0x2c5, subw 0x0, time 48472296, (-32,-123), root859,363),
state 0x10, keycode 120 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4000001,
root 0x2c5, subw 0x0, time 48472382, (-32,-123), root859,363),
state 0x10, keycode 120 (keysym 0x0, NoSymbol), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

So I added and commented out lines in /usr/share/X11/xkb/keycodes/xfree86 as below:
// Microsoft keyboard extra keys
// Comment and addition on 2014-07-25 to use unused physical Omni Key as a replacement for the Windows Key
// <LWIN> = 115;
<LWIN> = 120;
. . .
// Commented out on 2014-07-25 to use actual Omni Key as a Windows Key
// <FK15> = 120;

After rebooting, the key is recognized as "Super_L" as shown in the xev output below:

KeyPress event, serial 37, synthetic NO, window 0x4200001,
root 0x2c5, subw 0x0, time 49142127, (241,-71), root1132,415),
state 0x10, keycode 120 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 37, synthetic NO, window 0x4200001,
root 0x2c5, subw 0x0, time 49142270, (241,-71), root1132,415),
state 0x50, keycode 120 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

I assume from this that I chose the correct file to edit from the usr/share/X11/xkb/keycodes directory (how, by the way, would I have been able to determine which file was loaded/used when 14.04 starts? - I just pciked that as most likely by browsing through the many available.).
Pressing the key, however, does absolutely nothing. The Keyboard facility in System Settings seems to offer no method for assigning keys - only for assigning functions to existing keys.

Running "xmodmap -pm" gives the following output:

shift Shift_L (0x32), Shift_R (0x3e)
lock Caps_Lock (0x42)
control Control_L (0x25), Control_R (0x69)
mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
mod2 Num_Lock (0x4d)
mod3
mod4 Super_L (0x78), Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)

Does this mean that the "Super_L" key is only a modifier? What I want is the stock functionality of the key. Should I comment out or remove the mod4 line?

The key I'm attempting to map, by the way, is labelled "Omni" and is located in the center of a separate grouping (not the "numeric keypad") laid out like this, and with the keycodes reported by xev:
________________________________________
| Home | Up Arrow | PageUp |
| 110 | 111 | 112 |
|----------------------------------------|
| Left Arrow | OmniKey | Right Arrow |
| 113 | 120 | 114 |
|----------------------------------------|
| End | Down Arrow | PageDown |
| 115 | 116 | 117 |
|----------------------------------------|
| Insert | Delete |
| 118 | 119 |
----------------------------------------

I looked under /usr/share/X11/xkb/symbols to see if there was a corresponding xfree86 mapping, but there was none, so the "us" mapping seems to be the one in use. The Home, Arrow and Page Up/Down keys work as expected, although they have different keycodes than the ones on the numeric keypad. I am guessing that adding a line to the "us" file such as:

key <LWIN> { [ ??, ??, ??, ?? ] };

might do the trick, but what would I enter in place of the ?? characters (i.e. where are the definitions of values such as "minus" "underscore" and such, or what would it be for windows key functionality?

Since the Ubuntu System Settings didn't provide anything useful for addressing this, I followed another recommendation to use something called "gnome-control-center' from the command line. Ubuntu helpfully informed me that this was not available on my system, but could be installed by typing "sudo apt-get install gnome-control-center". So I did that, and it went through the usual process, after which I was able to launch this from the command line.

Surprise, surprise. Gnome Control Center is, in fact, the utility presented by the Systems Setting choice on the main screen. Of course, now I'm terrified that if I "uninstall" it (as it's obviously the same thing and therefore redundant) some things will be inadvertantly removed.

I've run dconf-editor, and found the following sections (recommended by a few folks), but these all just seem to duplicate the entries in the GUI tools, and have no apparent way to tell the system that my Omni key is really a "Super" key:
org | onboard | keyboard section
org | gnome | desktop | wm | keybindings
org | gnome | libgnomekbd | settings-daemon | peripherals | keyboard

Other suggestions included adding an .Xmodmap in my home directory with the line "keycode 120 = Super_L" (did nothing even after reboot) and creating an .xsessionrc with the line "xmodmap -e "keycode 120 = Super_L" (also did nothing even after reboot.

I also tried manually entering the two commands below, which was recommended on some sites, but it didn't seem to have any effect either.
xmodmap -e "add mod4 = Super_L"
xmodmap -e "keycode 120 = Super_L" -e "add mod4 = Super_L"

Can anyone tell me what I'm missing? Or has no one figured out yet what changes were made in Ubuntu 14.04 to keep us all guessing? (All these suggestions on the web apparently worked for the posters, but all of them seem to be for earlier versions than 14.04).
 
Old 07-30-2014, 11:26 PM   #2
notKlaatu
Member
 
Registered: Sep 2010
Location: Wellington, New Zealand
Distribution: Slackware
Posts: 461

Rep: Reputation: 119Reputation: 119
I would try placing this in ~/.Xmodmap:

Code:
clear mod4
keycode 120 = Hyper_L
add mod4 = Hyper_L
I'm using Hyper_L because I'm guessing that it is not in use.

Then do

Code:
xmodmap ~/.Xmodmap
and see what happens.
 
Old 07-31-2014, 09:14 AM   #3
CVAlkan
Member
 
Registered: Nov 2012
Distribution: Ubuntu 14.04 LTS
Posts: 42

Original Poster
Rep: Reputation: Disabled
Thanks for the suggestions ...

I tried what you suggested as well as variations using Super_L instead of Hyper_L and Unity just simply doesn't recognize the. It's only because of xev (and the fact that I can easily remap the key in Windows) that I know the keyboard works. I'll try it later with a "live-cd" to see if will work with a "naked" system (i.e. in case I've just mashed something along the way).
 
Old 07-31-2014, 04:07 PM   #4
notKlaatu
Member
 
Registered: Sep 2010
Location: Wellington, New Zealand
Distribution: Slackware
Posts: 461

Rep: Reputation: 119Reputation: 119
Yeah, could be Unity intervening, I guess. I am on Fluxbox and KDE, and my Xmodmaps work. Then again, I don't have an 'Omni' key, so who knows...!
 
  


Reply

Tags
keyboard xmodmap, ubuntu 14.04


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
Method for mapping a long key press to another key? iscariot Linux - Software 6 02-28-2014 01:40 PM
Linux Mint 12: Need Help: mapping super key to MGSE bottom panel menu NEQTAN Linux Mint 4 03-23-2012 10:31 AM
Keyboard mapping using xev see what key code, a key is bond to? NightSky Slackware 12 10-14-2011 04:03 AM
[SOLVED] Re-bind broken keyboard key to unused key rizzy Linux - Hardware 5 03-19-2011 01:57 PM
Mapping AltGr key to act as WIN key krisrao Linux - Newbie 3 02-11-2009 09:14 PM


All times are GMT -5. The time now is 04:46 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration