Home » Questions » Computers [ Ask a new question ]

Mapping Super+hjkl to arrow keys under X

Mapping Super+hjkl to arrow keys under X

I'm trying to map:

Asked by: Guest | Views: 74
Total answers/comments: 4
Guest [Entry]

"I haven't tried this myself but it looks like xkb might do what you want http://en.wikipediadotorg/wiki/X_keyboard_extension.

I have a package in Ubuntu called x11-xkb-utils that sounds promising :)"
Guest [Entry]

"This one works for me on Arch. It remaps Caps+hjkl to arrow keys, and Shift+Caps to Caps.

Put the following in ~/.Xmodmap:

! Remap caps lock to special modifier, but still allow shift+caps to
toggle caps lock
clear lock
clear mod5
add lock = Mode_switch
keycode 66 = Mode_switch Caps_Lock NoSymbol NoSymbol
keycode 43 = h H Left Left
keycode 44 = j J Down Down
keycode 45 = k K Up Up
keycode 46 = l L Right Right

Reboot or set it with xmodmap ~/.Xmodmap

If you get an error like:

X Error of failed request: BadValue (integer parameter out of range for operation)

It probably means that you need to clear something other than mod5 (whatever is currently set to Mode_switch). Check your current modifier mappings with xmodmap."
Guest [Entry]

"I am a HHKB user on Debian/Ubuntu and this solution works for me.

use Left Ctrl to active key.

$ vi ~/.Xmodmap
keycode 37 = ISO_Level3_Shift

Add this code under // End alphanumeric section in the basic block in /usr/share/X11/xkb/symbols/us

//hjkl
//Ctrl + hjkl
key <AC06> { [ h, H, Left ] };
key <AC07> { [ j, J, Down ] };
key <AC08> { [ k, K, Up ] };
key <AC09> { [ l, L, Right ] };

Now, you should be able to use left, down, up and right key with Ctrl + h, j, k, l.

By the way, if you have used pentadactyl on Firefox, you can add this code in ~/.pentadactylrc

map -modes=i,c <C-down> <down>
map -modes=i,c <C-up> <up>"
Guest [Entry]

"I found autokey and it is better for mapping.

I believe the link key binding - Emulate Keypad on Laptop - Ask Ubuntu might help you."