Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Keycode


  • Please log in to reply
16 replies to this topic

#1 ray5450

ray5450

  • Members
  • 457 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:20 PM

Posted 16 February 2015 - 05:42 PM

I am using Mint Linux for sort of an emergency use, but also my z and space keys are not working.  I found instructions that worked for the space key to reassign it to the right Alt key.  I would like to assign the z key preferably to the one with the Windows symbol on it between Fn and left Alt, but I do not know the keycode number.  This is what I found to use for the space/alt key, which worked:

 

sleep 8 && xmodmap -e 'keycode 108 = space' 

 

I know that 108 is the number for the right Alt key.  I really don't know much about Linux, and I think it is VERY user UNfriendly.

 

How can I find out the number of the key I want?

 

Thanks.



BC AdBot (Login to Remove)

 


#2 Al1000

Al1000

  • Global Moderator
  • 8,054 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:11:20 PM

Posted 17 February 2015 - 05:37 AM

How can I find out the number of the key I want?
Open a terminal and run
xev
...then press the key that you want the number of. On my computer the number of the key with the Windows symbol is 133.

 

To kill xev, open another terminal and run

killall xev


#3 ray5450

ray5450
  • Topic Starter

  • Members
  • 457 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:20 PM

Posted 17 February 2015 - 10:48 PM

When I tried xev, a couple pages worth of lines appeared...things like, "Motionnottify....", "Propertynotify...", etc., but 133 never showed up anywhere when pressing that key.  I used the 133 that you supplied, and it worked, thanks.

 

I have seen that there is a way to add it to Startup Applications, but I don't know how.  I have tried putting the lines in a textfile editor file, and adding it to Startup Applications, but that doesn't work.  How would I do that?  Thanks.



#4 Al1000

Al1000

  • Global Moderator
  • 8,054 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:11:20 PM

Posted 18 February 2015 - 02:38 AM

When I tried xev, a couple pages worth of lines appeared...things like, "Motionnottify....", "Propertynotify...", etc., but 133 never showed up anywhere when pressing that key.  I used the 133 that you supplied, and it worked, thanks.


For some reason if you do something like use your mouse to scroll back up the terminal screen after starting xev, xev will stop producing output. If you start xev and do nothing else except press keys on the keyboard, you should see something like this when you press the key with the Windows symbol:

KeyRelease event, serial 43, synthetic NO, window 0x2000001,
    root 0x132, subw 0x0, time 5320400, (-533,-113), root:(220,333),
    state 0x40, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

However, at least you now have the correct keycode in any case.

I have seen that there is a way to add it to Startup Applications, but I don't know how.  I have tried putting the lines in a textfile editor file, and adding it to Startup Applications, but that doesn't work.  How would I do that?  Thanks.


The first line of the script should be: !#/bin/bash

So the script should look like this:

!#/bin/bash
sleep 8 && xmodmap -e 'keycode 108 = space' &
xmodmap -e 'keycode 133 = whatever'

(replace "whatever" with whatever it is you have in your script - I have never used xmodmap so I'm not entirely sure what you are putting there)

It's important to add the ampersand symbol (&) at the end of the first line so that the script doesn't stop executing there, and there should be no need to add sleep to the second line, as all that would do is delay the second line from executing after the first line executes.

Then you need to make the file executable:

chmod +x /path/to/file

Now it should work.

Edited by Al1000, 18 February 2015 - 02:40 AM.


#5 ray5450

ray5450
  • Topic Starter

  • Members
  • 457 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:20 PM

Posted 18 February 2015 - 11:03 PM

(My first post should have said "Linux Mint")

 

1. Yes, you were right about the mouse issue.  It worked.

 

2.  "I have never used xmodmap"  I have never used any of this stuff.  I got the first line from a post somewhere.  These commands are so undescriptive compared to DOS.  I wouldn't be surprised if the command to copy a file, instead of "copy", it was "ftt##zq" or something.  Anyway, when I removed Sleep, it didn't work.  I put it back, and it worked.

 

3.  Something unrelated I noticed when I was rebooting to test the above, every time I do, it undoes the setting for brightness.  This screen is so bright, it about blinds me.  I turn it down in System Settings, then when I reboot, it is way bright again.  Is there a way to make the setting stay, unless I actually change it?

 

 

Thanks, for your help.


Edited by ray5450, 18 February 2015 - 11:05 PM.


#6 Al1000

Al1000

  • Global Moderator
  • 8,054 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:11:20 PM

Posted 19 February 2015 - 02:53 AM

2. "I have never used xmodmap" I have never used any of this stuff. I got the first line from a post somewhere. These commands are so undescriptive compared to DOS. I wouldn't be surprised if the command to copy a file, instead of "copy", it was "ftt##zq" or something. Anyway, when I removed Sleep, it didn't work. I put it back, and it worked.

The command for copy is cp, so you could probably guess that the command for move is mv and ls is for list, for example. I didn't know the DOS command for copy is copy, but from that I might have guessed that the command for list is list and not dir! I know very few DOS commands, but I find Linux is much more intuitive.

The sleep 8 part of the script just makes the script pause for 8 seconds before continuing to execute. I imagine it's necessary to put that in at the start of the script to give the computer time to assign keys to their standard settings, before your script reassigns them. Whereas without sleep your script might run first, then the operating system would subsequently reassign the keys to their standard settings.

What is your script now, and is it executing automatically as expected? This information might be useful to anyone who has the same problem.

3. Something unrelated I noticed when I was rebooting to test the above, every time I do, it undoes the setting for brightness. This screen is so bright, it about blinds me. I turn it down in System Settings, then when I reboot, it is way bright again. Is there a way to make the setting stay, unless I actually change it?

Here are a few things you could try.

http://ubuntuhandbook.org/index.php/2014/04/save-screen-brightness-settings-in-ubuntu-14-04/
http://askubuntu.com/questions/149054/how-to-change-lcd-brightness-from-command-line-or-via-script

#7 wizardfromoz

wizardfromoz

  • Banned
  • 2,799 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:20 AM

Posted 19 February 2015 - 03:34 AM

Hi, there is also

xkb

xmodmap has been basically in retirement since 2013.

 

Articles which refer are listed below

 

http://askubuntu.com/questions/24916/how-do-i-remap-certain-keys-or-devices

 

and

 

https://askubuntu.com/questions/325272/permanent-xmodmap-in-ubuntu-13-04/347382#347382?newreg=4eb097870a15490ebbe39d78412f9797

 

I should as a disclaimer say that I have not tried these myself, no need.

 

But given Mint is derived from Ubuntu?

 

BTW Al1000 - as well as "copy", there was "xcopy" - far more powerful and versatile, but that is a story for another time and another place.

 

Good luck to the OP - and ... worked with MS-DOS since the late 80's, and find Linux at least as good - all apples from the same tree.

 

:wizardball: Wizard



#8 Al1000

Al1000

  • Global Moderator
  • 8,054 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:11:20 PM

Posted 19 February 2015 - 04:02 AM

xmodmap has been basically in retirement since 2013.



Articles which refer are listed below

Using xmodmap is still the solution that is recommended in these articles.

Here's another one I noticed which looks much easier. Presumably there would be a similar setting in Mint.

Go to System Settings > Keyboard Layout > Options...
In the Keyboard Layout Options, click the arrow to reveal the ▸ Ctrl key position options.
Put the checkmark in at Swap Ctrl and Caps Lock.

There you go: Left Control and Caps Lock have switched positions.

https://askubuntu.com/questions/325272/permanent-xmodmap-in-ubuntu-



#9 ray5450

ray5450
  • Topic Starter

  • Members
  • 457 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:20 PM

Posted 20 February 2015 - 12:54 AM

1. Yes, the script is working.  However, the reassigned keys do not work in an internet browser.

 

2.  I don't know how Linux could be more intuitive.  Long ago, there used to be books that came with the computer one bought, which was a DOS reference manual.  Mine are very well written.  I know about all there is to know about DOS.  Could you recommend me one for Linux commands?

 

3.  Brightness:  are you joking?  Not you actually...but Linux?  This operating system was not designed for someone who does not want to write the other half of it himself.  I am glad I got to try it and find that out.  It is only temporary until I get my Windows machine back.  It had a broken AC socket.

 

Thanks, again.



#10 Al1000

Al1000

  • Global Moderator
  • 8,054 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:11:20 PM

Posted 20 February 2015 - 04:01 AM

1. Yes, the script is working. However, the reassigned keys do not work in an internet browser.

Well at least the issue is partly solved. Could you please post your script for the benefit of anyone else who might have a similar problem?

2. I don't know how Linux could be more intuitive. Long ago, there used to be books that came with the computer one bought, which was a DOS reference manual. Mine are very well written. I know about all there is to know about DOS. Could you recommend me one for Linux commands?

My first computer came with Windows '98 and I don't recall getting a book with it. I recommend A Practical Guide To Linux Commands, Editors, and Shell Programming. You can find a link to an older edition that you can download for free here.

3. Brightness: are you joking? Not you actually...but Linux? This operating system was not designed for someone who does not want to write the other half of it himself. I am glad I got to try it and find that out. It is only temporary until I get my Windows machine back. It had a broken AC socket.

Computers are designed to work on Windows; Linux is designed to work on computers. While most Linux operating system will work on most computers, some work on some computers better than others do, and laptops in particular are more fussy. Have you tried any other Linux operating systems besides Mint? The poster I quoted from the forum that Wiz posted a link to didn't seem to have any problems reassigning keys using the GUI on Ubuntu.

Edited by Al1000, 20 February 2015 - 04:02 AM.


#11 wizardfromoz

wizardfromoz

  • Banned
  • 2,799 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:20 AM

Posted 20 February 2015 - 05:22 PM

There is also xkeycaps for this purpose. Written by Jamie Zawinski in 1991, but only maintained until 2005. It is a GUI front-end for xmodmap, and features 208 different keyboard configurations.

 

A description by the author can be found here - http://www.jwz.org/xkeycaps/ and the Manual here - http://www.jwz.org/xkeycaps/man.html

 

xkeycaps is in the official repositories of a number of Linux Distros, but may need to be installed. This from Mint.

 

arO4eJc.png

 

Once installed, it does not show up in Mint's menu, but may in others, so if not, open Terminal, type and enter as follows

 

7ViKk8B.png

 

...and the GUI will fire up into two windows.

 

Before I go further, I have left out a step I had cause to learn only later.

 

xkeycaps changes the configuration file for xmodmap on your PC, which can be found in your Home folder (after Ctrl-H reveals hidden files and folders), named with the sequence ".xmodmap-<name of your computer>", in my case PC is "hermes", hence

 

wnRCRVf.png

 

After the first pair of swapped keys is effected, my original conf is saved as .xmodmap-Hermes.bak, with the familiar green triangle icon. Before proceeding further with xkeycaps, you are well advised to back up your original config, eg rename it, as I am unaware whether further changes made in xkeycaps will cause you to lose your original config.

 

Back to those two windows, which are

 

06rMmoo.png

 

and

 

6kleDUl.png

 

The icon of the keyboard changes as you choose different brands and models.

 

My Acer keyboard doesn't rate a mention, it has four (4) keys left of the Space bar, being Ctrl, (Context) Menu, Super (Windows) and Alt - so I did not complete the desired z to Super swap, but remapped some other keys, using the default  PC 105 key, wide Delete, tall Enter (XFree86; US)  option. After leaving xkeycaps, I went to play Aisleriot Patience and found my shortcut keys Ctrl-N and Ctrl-Z had vanished.

 

Hence the need for backup on the xmodmap config. I simply blew away the new one, renamed the old one, rebooted, and back again playing Patience.

 

On leaving xkeycaps, you are returned to Terminal, where you may see the following:

 

zh9frqg.png

 

The warnings were generated during the xkeycaps session (I could see the underlying window) and I ignored them as they seemed related only to font presentation.

 

The fatal error I have no answer for, but it did not seem to impact on the functions of xkeycaps.

 

xkeycaps is old, it has clunky navigation, but it may do what you need of it. And of course it is free.

 

A couple of things before I go:

  1. I wouldn't remap the Super (Windows) key unless you have two of them, they are a fast way to call up Menus
  2. The Super key has been around on *nix systems for far more years than since Bill Gates stuck a Windows icon on it. This corroborates what Al1000 was saying
  3.  

    Computers are designed to work on Windows; Linux is designed to work on computers.

     

  4. ray5450, if you could post that script as Al has suggested, this Topic can be left open to help others, as well as yourself, should you return to the Wonderful World of Linux.

Keep Smilin'

 

:wizardball: Wizard



#12 ray5450

ray5450
  • Topic Starter

  • Members
  • 457 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:20 PM

Posted 21 February 2015 - 12:23 AM

Al1000:

1. Posted script--next post.

 

2. My 2nd computer came with Windows  3.1 and DOS 5.  Thanks for the link.

 

3. Okay, sigh...lol, I'll try it.

 

Wiz:

1. Thanks, but that is just too much for me.  You must have posted that for others for whom it would be easier to do.

 

2. I have never used that "Super" key in 20 years.



#13 ray5450

ray5450
  • Topic Starter

  • Members
  • 457 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:20 PM

Posted 21 February 2015 - 12:27 AM

1#/bin/bash

sleep 8 && xmodmap -e 'keycode 108 = space' &

sleep 8 && xmodmap -e 'keycode 133 = z'



#14 wizardfromoz

wizardfromoz

  • Banned
  • 2,799 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:09:20 AM

Posted 21 February 2015 - 03:43 AM

Thanks for posting that code Ray.

 

 

You must have posted that for others for whom it would be easier to do.

 

... not really, I have only been with Linux fulltime since last August, as my colleagues could tell you. Look at my Profile, and you may see similarities with your history. I go back to DOS 3.1 in the workplace, with DOS 4.0 upgraded to 5.0 on my first home PC, an AT 286 with a 40MB HD, 1 MB RAM, and a 12 MHz clock. I taught it to think it was a 386 using the DOS commands, and even after software became obsolete, used

setver

...to make the PC think the software was from the latest version of Windows.

 

 

Okay, sigh...lol, I'll try it.

 

Don't feel pressured to do anything, Ray. You are the OP (Original Poster aka Topic Starter) whom asked a question. If you are only with "us" (in Linux) for a short time, you have the right to consider the advice irrelevant, and pursue your own path. You have been with the site for over two years, so I presume it has some worth to you, if only in Windows matters, prior to this.

 

If you want to keep your hand in with Linux, then consider Live CD solutions, and in particular Puppy Linux. I am experimenting with Wary Puppy 5.5 at the moment on my wife's old laptop, and it gets up and flies - but you can also use Puppy as a safeguard against the Nasties in Windows.

 

Take care, and good luck in whatever you choose. Hope to see you again (but not through calamity!)

 

:wizardball: Wiz



#15 ray5450

ray5450
  • Topic Starter

  • Members
  • 457 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:06:20 PM

Posted 21 February 2015 - 10:14 PM

Your first quote:  since August is still a long time, and you must have been part-time before that, it is still way more than me (2 weeks).

 

Your 2nd quote:  I was being humorous.

 

Thanks.


Edited by ray5450, 22 February 2015 - 10:01 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users