Jump to content

need help in rebinding


Go to solution Solved by SunLight,

Recommended Posts

Posted

i need help to rebind the esc key and the ! key to some other key . those keys are broken in my lappy keyboard . Binds to any other key are welcome :)

  • Leader
Posted

Which os? Windows? Linux?

I thought of that, too, but couldn't find the key-remapper in Vista easily.  Yet.

 

 /bind escape returns "togglemenu" in ET.  I tried "/bind f5 togglemenu" but pressing f5 ingame returns "unknown command togglemenu".

Posted

I believe you cannot change toggleconsole or esc - you will have to buy a new keyboard. (after using the command /unbind all, esc and toggleconsole remain bound - I expect so you don't get stuck if you close your game and then can't open console or something)

  • Clan Friend
Posted

i am using ubuntu . i will install xp sp2 in a while , but i am waiting for the cd .

I use Arch Linux, but I think the commands are the same

 

type this:

 

$ xmodmap -pke | less

 

you will see a list of keycodes, and what they are 'binded' to

(to quit from less press q, but probably you know that already if you use Linux)

 

In my case I see:

 

keycode   9 = Escape NoSymbol Escape

 

now type:

 

$ xev

 

press the key you want to remap to ESC, and see the keycode of that key

(you might want to go back to xmodmap -pke and note the current binding for that key, if you want to restore it)

 

let's say this key you want to change has keycode 35 (just an example)

 

you bind it to ESC with this:

 

$ xmodmap -e 'keycode 35 = Escape NoSymbol Escape'

so you copy the same thing but instead of 9 you put the keycode of the key you want to change.

 

now key 35 will be ESC as well.

 

I don't think it's saved, so when you reboot you have to do it again or put it in some script

Posted

I use Arch Linux, but I think the commands are the same

 

type this:

 

 

$ xmodmap -pke | less
 

you will see a list of keycodes, and what they are 'binded' to

(to quit from less press q, but probably you know that already if you use Linux)

 

In my case I see:

 

keycode   9 = Escape NoSymbol Escape
 

now type:

 

$ xev
 

press the key you want to remap to ESC, and see the keycode of that key

(you might want to go back to xmodmap -pke and note the current binding for that key, if you want to restore it)

 

let's say this key you want to change has keycode 35 (just an example)

 

you bind it to ESC with this:

 

$ xmodmap -e 'keycode 35 = Escape NoSymbol Escape'
so you copy the same thing but instead of 9 you put the keycode of the key you want to change.

 

now key 35 will be ESC as well.

 

I don't think it's saved, so when you reboot you have to do it again or put it in some script

 

 

So I won't be able to change the bind inside ET , and so , i am changing the bind for the whole ubuntu os right ?

okay then , i will try it . if it works , i must just open the et script with gedit and add these lines . right ?

 

And my papa too will be buyin a keyboard in a while . I am still unable to achieve playable frame-rates in ubuntu so i thought atleast i can spectate .

 

 

 

 

and how to remap the "exclamation mark " in et . i need it to use the commands right ?

  • Clan Friend
Posted

So I won't be able to change the bind inside ET , and so , i am changing the bind for the whole ubuntu os right ?

okay then , i will try it . if it works , i must just open the et script with gedit and add these lines . right ?

 

And my papa too will be buyin a keyboard in a while . I am still unable to achieve playable frame-rates in ubuntu so i thought atleast i can spectate .

 

 

 

 

and how to remap the "exclamation mark " in et . i need it to use the commands right ?

Well, since you wanted to rebind exclamation mark as well, I thought you needed to rebind it 'globally', after all I don't think you can rebind esc in et

 

$ xmodmap -pke | less

 

keycode  10 = 1 exclam 1 exclam onesuperior exclamdown onesuperior

 

in *my* case (it depends on your keyboard layout) keycode 10 has exclamation mark ('exclam')

 

the order of the entries is this:

1 (if the key is pressed normally)

exclam (pressed with shift)

1 (with mode switch)

exclam (mode switch+shift)

onesuperior (with altgr)

exclamdown (altgr+shift)

onesuperior (no idea here :P)

 

let's see:

 

$ xmodmap

xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):



shift       Shift_L (0x32),  Shift_R (0x3e)

lock        Caps_Lock (0x42)

control     Control_L (0x25),  Control_R (0x69)

mod1        Alt_L (0x40),  Meta_L (0xcd)

mod2        Num_Lock (0x4d)

mod3     

mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)

mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)

so mode switch is 0xcb (hexadecimal) in decimal it would be keycode 203, but even using xev I couldn't figure out which key it is on my keyboard :D

 

Anyway, if you want to set exclamation mark to some key, instead of a symbol you use, you do the same way as esc.

 

i.e. first decide which key you want to move the exclamation mark to (using xev you will know the keycode)

 

then do:

 

$ xmodmap -e 'keycode num = keys'

where num is the keycode you found, and keys are the keys you want (the 1st one is when you press it without anything, then with shift, etc.) copy the key names from the output of xmodmap -pke

Posted

it works , 127 is the keycode for "pause / break button and i bound it to esc " ...

 

then i bound 1 to home key which has keycode 110 . it works :) yay .

 

thousand thanks to you :)

 

p.s : i have the same key codes as you have so , can you make a script which makes the rebind and the script which brings it back to normal . i am a total newbie . or it would be enough if you just give me help on how to make a script :)

  • Clan Friend
  • Solution
Posted (edited)

p.s : i have the same key codes as you have so , can you make a script which makes the rebind and the script which brings it back to normal . i am a total newbie . or it would be enough if you just give me help on how to make a script :)

 

cd somewhere (folder where you want to put the keyboard maps and the script), for example your home folder

 

$ cd ~ (same as /home/username)

$ xmodmap -pke > keys_default.txt

this '>' redirects the output of the command to a text file.

 

edit keys_default.txt, and remove all the keys you don't need to change or restore (otherwise if you keep all keys it will be very slow, at least in my case it is) maybe save a copy of the whole layout for restoring it.

 

with only the lines you need, it could be something like (these are my default values):

 

keycode 110 = Home NoSymbol Home NoSymbol Home

keycode 127 = Pause Break Pause Break Pause Break

 

now save it, then save a copy and call it keys_modified.txt, and edit it like this (for example)

 

keycode 110 = Home exclam Home NoSymbol Home

keycode 127 = Escape NoSymbol Escape

this way key 127 will be ESC

in this example key 110 will be home, but if you press it with shift it will be ! (it's in the second place, and as I told you before the second element is key+shift)

you can make it as '1 exclam 1 exclam onesuperior exclamdown onesuperior' if you want it like the key 1, but then you will have no home key, it's up to you, you have to experiment

 

you can load the modified one with

$ xmodmap ~/keys_modified.txt (you can also type /home/username/keys_modified.txt if you don't wanna type ~)

 

back to the normal one:

$ xmodmap ~/keys_default.txt

 

you could also make a script like this (call it keyboard.sh, for example)

 

#!/bin/bash

xmodmap ~/keys_modified.txt

 

make it executable

$ chmod +x keyboard.sh

 

then you can run it with

$ ./keyboard.sh (assuming that you are in your home folder)

 

actually, having separate txt files with key definitions is a bit too much, if you only want to just change a couple. You can make 2 scripts like this, and it's simpler:

 

change.sh

 

#!/bin/bash
xmodmap -e 'keycode 110 = 1 exclam 1 exclam onesuperior Home onesuperior'

xmodmap -e 'keycode 127 = Escape NoSymbol Escape'

 

restore.sh

 

#!/bin/bash
xmodmap -e 'keycode 110 = Home NoSymbol Home NoSymbol Home'

xmodmap -e 'keycode 127 = Pause Break Pause Break Pause Break'

 

remember to make them executable with chmod +x filename.sh

 

p.s.

I think that if you save your keyboard map as

~/.Xmodmap

it will be autoloaded when X starts

Edited by SunLight

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.