Quote:
Originally Posted by p4ntysh0t
Are there any scripts like this written for linux? Im useing Ubuntu 6.10 Edgy Eft on a laptop so I guess you can imagine how trying to use the actual directional keys worked out. lol
|
I am also a Linux user and it is also on laptop. I use Ubuntu 7.04 Feisty Fawn but it should be the same.
First you need to know what key you want to remap. I want to map these:
d -> Left
f -> Down
j -> Up
k -> Right
Fire up gnome-terminal and type in
xmodmap -pke | less
You should see output like this:
Code:
keycode 40 = d D
keycode 41 = f F
keycode 42 = g G
keycode 43 = h H
keycode 44 = j J
keycode 45 = k K
You need these
keycodes and
keysyms. Now I know that:
d =
40 =
d
f =
41 =
f
j =
44 =
j
k =
45 =
k
Open up your favorite text editor and then type in this code:
Code:
# Remap keycode to Left Down Up Right
xmodmap -e "keycode 40 = Left"
xmodmap -e "keycode 41 = Down"
xmodmap -e "keycode 44 = Up"
xmodmap -e "keycode 45 = Right"
# Wait for press enter
echo "Press enter to remap map it back"
read TEMPNOTHINGHAHA
# Remap the keycode back to original keysym
xmodmap -e "keycode 40 = d D"
xmodmap -e "keycode 41 = f F"
xmodmap -e "keycode 44 = j J"
xmodmap -e "keycode 45 = k K"
Save it with this name: "~/remapffr"
Now whenever you want to remap the keys just open the terminal and say
sh ~/remapffr
Now the keys should be remapped. Whenever you want to map the keys back you just go back to terminal and press "enter".
Warning: May break keyboard layouts! Use it at your own risk!