Jump to content

  • Log in with Facebook Log in with Twitter Log In with Steam Log In with Google Sign In
  • Create Account
Photo

need help in rebinding

- - - - - rebinds

Best Answer SunLight, 30 March 2013 - 06:10 AM

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

Go to the full post »


  • Please log in to reply
10 replies to this topic

#1
rajaah thunder

rajaah thunder

    L4: Apprentice

  • Inactive Member
  • 446 posts
77
On the road to fame
  • Admin:12
  • Server:Silent #1
  • Alias:=F|A=Rajaah Thunder
  • T-M:ET: 1-0

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 :)




Click here to login or here to register to remove this ad, it's free!

#2
SunLight

SunLight

    L11: Assassin

  • Clan Friend
  • 5,093 posts
3,231
Is a bearer of wisdom
  • Admin:10
  • Server:ETSW2
Contributor

Which os? Windows? Linux?



#3
RedBaird

RedBaird

    What does this thing do? I will push it and see...

  • Leader
  • 6,197 posts
4,867
Glorious beacon of light
  • EvolveHQ:FA_Redbaird
  • Admin:20
  • Server:Jay1
  • Alias:=F|A=RedBaird
  • T-M:ET: 13-4

Donator

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".



#4
rajaah thunder

rajaah thunder

    L4: Apprentice

  • Inactive Member
  • 446 posts
77
On the road to fame
  • Admin:12
  • Server:Silent #1
  • Alias:=F|A=Rajaah Thunder
  • T-M:ET: 1-0

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



#5
jaie

jaie

    FishEyed

  • Inactive Member
  • 1,970 posts
579
Has a brilliant future
  • Admin:16
  • Server:None
  • T-M:ET: 7-6
    CS: 1-1
Contributor

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)



#6
SunLight

SunLight

    L11: Assassin

  • Clan Friend
  • 5,093 posts
3,231
Is a bearer of wisdom
  • Admin:10
  • Server:ETSW2
Contributor

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



#7
rajaah thunder

rajaah thunder

    L4: Apprentice

  • Inactive Member
  • 446 posts
77
On the road to fame
  • Admin:12
  • Server:Silent #1
  • Alias:=F|A=Rajaah Thunder
  • T-M:ET: 1-0

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 ?

#8
SunLight

SunLight

    L11: Assassin

  • Clan Friend
  • 5,093 posts
3,231
Is a bearer of wisdom
  • Admin:10
  • Server:ETSW2
Contributor

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



#9
rajaah thunder

rajaah thunder

    L4: Apprentice

  • Inactive Member
  • 446 posts
77
On the road to fame
  • Admin:12
  • Server:Silent #1
  • Alias:=F|A=Rajaah Thunder
  • T-M:ET: 1-0
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 :)

#10
SunLight

SunLight

    L11: Assassin

  • Clan Friend
  • 5,093 posts
3,231
Is a bearer of wisdom
  • Admin:10
  • Server:ETSW2
Contributor
✓  Best Answer

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, 30 March 2013 - 06:17 AM.


#11
rajaah thunder

rajaah thunder

    L4: Apprentice

  • Inactive Member
  • 446 posts
77
On the road to fame
  • Admin:12
  • Server:Silent #1
  • Alias:=F|A=Rajaah Thunder
  • T-M:ET: 1-0
thanks a lot man :) case closed :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users