Click to See Complete Forum and Search --> : Swapping two keys in my Keyboard...


Wallex
08-25-2002, 06:26 PM
I just noticed that my keyboard's layout has a small mistake. The right win key is swithed with the 'menu' key (so when I press one, the other is the one actually triggered), where do I go and fix this? And don't tell me to just pull out both keys and exchange their places.

cyberhwk
08-26-2002, 11:25 AM
Why can't you just pull out both keys and switch them? :D
Its an ez solution and it requires no real knowledge. Else I guess you can find something to remap your keyboard.

Wallex
08-26-2002, 01:27 PM
I think.... Hmm.... *thinks hard*. Oh whatever, I'll just swap the keys, I feel too lazy to go learn about keyboard key mapping right now... plus, it's been a while since I last cleaned this keyboard.

cyberhwk
08-26-2002, 04:54 PM
TaDA!!!! The easy way wins again!!!:D

mdwatts
08-26-2002, 05:18 PM
I actually read your post before I left for work this morning, but didn't reply yet as I wanted to see if you would give in to swapping the actual keys.

Guess I was right... :D

Look into using xmodmap.

man xmodmap

And plenty of documentation can be found to also help with a Google for Linux search.

Wallex
08-26-2002, 07:30 PM
Aah... man xmodmap confuzzles me. I am not yet experienced enough to play with it.. or I am? I am still trying to understand some of the names like key_sym. Hmm... I think I'll try harder... afterall, I am already used to the menu key being next to the AltGr one. Easy solutions are temporary solutions most of the time, I have to get this 'definitely' fixed.
EDIT: Ahh.... I am supposed to modify some file with xmodmap. Hmm.. but I have no idea which is the file I need to modify... oh well, I think I'll just have to succumb and be weak. The easy way.. for when you don't have time for anything else.

bwkaz
08-26-2002, 08:59 PM
Here's a hint: Run xev and press both keys (individually). Remember their "numbers".

Then run xmodmap -pm and visual-grep through the output for both of those "numbers".

Then run xmodmap -e "keycode <"number" of one key> <keysym from the other key> <"number" of the other key> <keysym from the first key>

See if that helps...

Wallex
08-26-2002, 11:33 PM
Woo! I don't know how.. but it worked! Well the hint wasn't all 'that clear', but it's good to use my brain to solve problems for a change. I am glad it's fixed... and to think I spent so much time swapping those keys.. now I have to swap them back. By the way... I was able to run xmodmap without being a root and I was able to change the keys as well.. will the changes be permanent? I hope so, I wouldn't like doing that again each time I boot my pc. Thanks for the 'hint' anyway!

cyberhwk
08-26-2002, 11:50 PM
congrats!!! My solution was a temp. fix but it seems like you found to perment solution. :-D

Wallex
08-27-2002, 10:59 AM
Originally posted by cyberhwk
congrats!!! My solution was a temp. fix but it seems like you found to perment solution. :-D
Not so permanent... I had to input the lines again when I rebooted. Hmm.... I wonder what should I do to keep the changes 'permanent'... you can't expect me to just add both those lines to my init.rc, can you? (this sounds like another 'easy' solution to my current issue)

bwkaz
08-27-2002, 11:59 AM
Is there a .xinitrc file in your home directory (it'll be hidden by default because of the dot as the first character, but ls -a should show it)? If so, add those xmodmap lines to it somewhere before the "exec <something>" line.

If not, edit (as root) /etc/X11/xinit/xinitrc (at least, that's where it is for a source install, but it might be somewhere else, depending on your distro) and add the xmodmap's somewhere before the "exec <something>" line.

Wallex
08-27-2002, 04:21 PM
Edit .xinitrc? That's exactly what I didn't want to do... I thought that modifying .xinitrc would be a 'patch' to fix my problem (in the same way switching the keys would have been a path for the initial problem). Oh well.. I'll go do that, and I hope that this time there won't be someone else who tells me of the 'good way' of doing it, but hasn't done so before just to see if I would just go the easy way and edit the xinitrc. Sounds like deja vu to me.
EDIT: Aha! I was able to avoid my own destiny! While inside the root .xinitrc, I saw the path to the Xmodmap file, which was a link to the real Xmodmap, which was readonly for everyone, I changed that through mc, then vi'ed into the file, and swapped the codes of the R_Win and Menu keys. Saved, quit vi, return the chmod as it was, and save, quit, save quit as needed. Now it's permanently fixed! It feels great when I can fix something without having to ask for a million hints about it.