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.
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:
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
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...
If you have Ubuntu+Gnome and
xev
does not show anything when you typeFn+Left
orFn+Right
- than you might have an interceptor in Gnome session like I did. Also my hardware laptop keyboard shows"backward"
and"forward"
player/music icons for left and right buttons - it means my hardware keyboard sendskeycode 173
forFn+Left
andkeycode 171
forFn+Right
.Disable gnome session listeners
You can disable listeners with UI
dconf-editor
.Install and run
dconf-editor
.Go to the following paths and disable
Use default value
and put empty array[]
inCustom value
.For
Fn+Left
:/org/gnome/settings-daemon/plugins/media-keys/previous-static
.For
Fn+Right
:/org/gnome/settings-daemon/plugins/media-keys/next-static
Apply changes for both paths and close
dconf-editor
.Apply software buttons mapping with xmodmap
Now apply custom handler for
Fn+Left
:Before this setting it was for me
xmodmap -pk | grep -i '171'
:After this setting:
Apply custom handler for
Fn+Right
:Before
xmodmap -pk | grep -i '173'
:After:
Now it works for me. However the result is not permanent, after reboot you have to do this again. Some startups scripts to do this do not work nice, because
xmodmap
must be initialized only after some time (when it is ready).Apply software buttons mapping with xkb
Turns out that
xmodmap
is outdated and not used anymore in Gnome.Permanent solution is to use
xkb
.Create symbol file
fn_mod
at/usr/share/X11/xkb/symbols/
(sudo requires) with following content:Make backup for following files in case you will brake them:
Add following content into
evdev.xml
(<xkbConfigRegistry>
-><optionList>
->):Add following content into
evdev
(Find line! option = symbols
and append on the next line):Add following content into
evdev.lst
(Find line! option
and append on the next line):evdev.xml
changes will create UI tweak ingnome-tweaks
. To check/enable this opengnome-tweaks
go to theKeyboard & Mouse
->Additional Layout Options
->Fn key behavior
.Finally reboot the session and check in terminal.