Assigning a character to a function key

David Hummel lemmuh-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Fri Dec 18 09:05:25 EST 2009


On Thu, Dec 17, 2009 at 6:13 PM, Stephen Ronan <sronan-VmQCmMdMyN0AvxtiuMwx3w at public.gmane.org> wrote:
>
> I'm helping someone with a problem laptop. I've put
> Ubuntu-based Linux Mint on it, which is working well. The two
> major remaing problems are:
> 1) it's reporting lots of bad sectors on the hard drive
> 2) The "u" key doesn't work.
>
> In regard to 1), I'm planning to use Spinrite, but am curious as
> to whether there may be any free programs that similarly can help
> with bad sector problem?
>
> In regard to 2, is there a way to assign "u" to a function key?
> I'd be grateful for any advice on a good way to do that.

First, determine the keycode for the function key using xev (man 1
xev).  The code for the F12 key should be 96.

Next, determine the keysym name for the "u" using xev.  The name for
this key is "u".

Next, map it in your ~/.Xmodmap file (man 1 xmodmap) with an entry like:

! map f10 to u
keycode 96 = u

Then execute the xmodmap program:

$ xmodmap ~/.Xmodmap

This will be executed automatically each time you start an X session.

It's more complicated if you want to control shift behavior (e.g.
Shift-F12 = U).





More information about the Discuss mailing list