Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'd like to add set a functionality to the pair fn+right/left to be like in Mac - 'home' and 'end'. I don't mean to replace the 'home' and 'end' buttons - just adding another 'home'/'end' keys. The advantage is in writing/modifying text. I use the arrows a lot, and I also use the home and end buttons, but why jump to a whole new button? My left hand is already near the fn (function) key - ready to press control or shift.

How do I set this?

Thanks.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

I definitely understand why you want to do this! Here's my bet what I have done:

Launch a terminal and run 'xev'. Place your mouse cursor over the Event Tester window and press fn+right/left. You should get a read-out like:

    KeyRelease event, serial 36, synthetic NO, window 0x5200001,
root 0xb2, subw 0x0, time 89989888, (98,124), root:(1007,175),
state 0x0, keycode 171 (keysym 0x1008ff17, XF86AudioNext), same_screen YES,
XLookupString gives 0 bytes: 
XFilterEvent returns: False

This is for my keyboard and fn+right. Find the keycode -- here it's 171.

Now go edit your .bashrc file in your home directory. It's hidden, so pres Ctrl+H in Nautilus to show. Then add lines

    xmodmap -e "keycode 171 = Home"
    xmodmap -e "keycode xxx = End"

where you replace the 171 and xxx with the obtained keycodes. Then save and close the file. Close all your terminals, open one, and you should be ready to go!

Now, there is one draw-back: you have to activate this on every boot. You do that by opening a terminal, and that's it. You can close it again immediately. Or you can try fixing it to do it automatically, as described here. I just run the terminal using a shortcut and then kill it...

share|improve this answer
    
The keycode for fn+right is the same as just pressing right (without fn). This is problematic, because I don't want to override my right/left key. –  kilaka Sep 27 '11 at 11:26
    
Well, then it may not be a "function key" (or what the correct term is). My arrows are, but they are also media keys. Then I don't know what to do, sorry. –  Rasmus Oct 15 '11 at 16:31
    
Thanks anyhow. This is still a great way to change keyboard behavior :) –  kilaka Oct 16 '11 at 14:20
    
You can add a script to the session startup configuration. If you are on GNOME based environment, execute the gnome-session-properties command. –  eagleoneraptor Jun 18 '13 at 15:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.