Asking the GNU/Linux God

Place to discuss anything, almost. No politics, religion, Microsoft, or anything else that I (the nazi censor) deem inappropriate.
Post Reply
Jenda
programmer
programmer
Posts: 156
Joined: Mon May 23, 2005 9:46 am
Location: Prague, Czech Republic
Contact:

Asking the GNU/Linux God

Post by Jenda » Wed Oct 26, 2005 9:45 am

I now bow down in piety to the Linux God that goes under the name of...
VOID MAIN

As a rule, I never bother your divine presence, unless in dire need. Indeed.

But the worst has come and no one else can provide. No guide.

What I need is a merge between one keyboard and one more. Nevermore...

How can I edit a particular key to give a particular keysym? I need to replace the number keys with Czech accent keys because there is no Czech version of dvorak. Call me stupid (your highness), but I just can't figure xmodmap out - I only managed to screw up my existing QWERTZ Czech layout...

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed Oct 26, 2005 11:43 am

Didn't you read the disclaimer when you signed up about no religion? :) Actually it's pretty easy, I use it to switch the CTRL and CapsLock keys on my Sun keyboard at work (they're reversed from PC layout). To see what your current settings are just do "xmodmap -pke". You should see the number key assignments at around "keycode 10" through "keycode 19". Say you wanted to switch your 4 and 5 keys (and their shift values) which on my system are defaulted to this:

keycode 13 = 4 dollar
keycode 14 = 5 percent

You can reverse them by:

Code: Select all

xmodmap -e "keycode 14 = 4 dollar"
xmodmap -e "keycode  13 = 5 percent"
Or just put this in your ~/.Xmodmap:
keycode 14 = 4 dollar
keycode 13 = 5 percent

Remember once you set one key to what the other key is you lose control of they will both be assigned the same thing so you won't be able to use that number if you are trying to do it interactively. You'll have to either use your numberpad (which gives different key codes) or put your commands in a script, or put them in your ~/.Xmodmap as stated. It's all pretty well explained in the man page:

http://www.xfree86.org/4.2.0/xmodmap.1.html

Jenda
programmer
programmer
Posts: 156
Joined: Mon May 23, 2005 9:46 am
Location: Prague, Czech Republic
Contact:

Post by Jenda » Wed Oct 26, 2005 12:50 pm

Thank you thank you I grovel in the dust before you damn that's so easy I should've figured it out...

I thought that meant no other religion.

You mentioned the Capslock thing before (remember the dvorak debate?).
I'm aware that I'll lose the numbers: I consider them redundant, since we have the numpad.

And how do you make it update to the new modmap file?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed Oct 26, 2005 12:59 pm

The ~/.Xmodmap is the file where your cutomizations reside. This will get installed at logon (may be Red Hat/Fedora specific but I don't think so). Otherwise if it does't you can issue "xmodmap ~/.Xmodmap" which will apply them. You can create a default one with:

xmodmap -pke > ~/.Xmodmap

and then modify the file to your liking.

Jenda
programmer
programmer
Posts: 156
Joined: Mon May 23, 2005 9:46 am
Location: Prague, Czech Republic
Contact:

Post by Jenda » Wed Oct 26, 2005 1:49 pm

OK. Thanks a bunch.

BTW in Ubuntu, it would seem that all the modmaps are stored centrally (/usr/share/xmodmap/xmodmap.dvorak in my case), not in the users' directories.

I now have a fully functional Czech-English Dvorak Layout.

Wait... no, not fully functional.

There's one more thing. The Czech keyboard has two special characters, the caron (ˇ) and the acute (´), which are applied above letters (ěščřžýáíé) by being pressed before the letter in question. I asigned the two to keys, but they are now placed immediately after the keystroke (ˇc instead of č).
Would you know how to fix this? (My souvereign?)

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed Oct 26, 2005 2:09 pm

Not off the top of my head but I can check into it later. Regarding the file you edited, that is the system wide xmodmap. Red Hat/Fedora also has a system wide xmodmap but I personally wouldn't change unless everyone using it wants the same keymap. Of course you are probably the only one using it. :)

Jenda
programmer
programmer
Posts: 156
Joined: Mon May 23, 2005 9:46 am
Location: Prague, Czech Republic
Contact:

Post by Jenda » Wed Oct 26, 2005 2:21 pm

I am indeed. Where would you look for such info?

Ah... nevermind. I simply opened xmodmap.cz and it's all there.

If you're interested, they're called deadkeys... dead_caron dead_acute...

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed Oct 26, 2005 2:29 pm

Cool, glad you found it!

Jenda
programmer
programmer
Posts: 156
Joined: Mon May 23, 2005 9:46 am
Location: Prague, Czech Republic
Contact:

Post by Jenda » Sun Nov 20, 2005 4:04 am

God?
...
Void?
...
Are you there?
...
I grovel on the ground before you, in the gravel on the ground under your feet an' all, but I have one more cheeky question to ask.
Whenever I use xmodmap to switch between layouts, most of my keyboard shortcuts cease to work. It seems to me that anything that involves modifier keys is simply ignored (Ctrl+Alt+F1 to switch consoles, Ctrl+Alt+cursorkey to witch workspaces), and yet I think the xmodmap files are right with the mods and all, and Ctrl+Alt+Bcksp works fine (I think). It gets back to normal after reboot (and presumably a Ctrl+Alt+Bcksp).
Do you have any idea, in your immensely broad and yet deep knowledge and wisdom... blah blah blah ?

Thanks,
Jenda

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Sun Nov 20, 2005 11:13 am

What do your two maps look like and how do they differ from the output of "xmodmap -pke" when things are working?

Jenda
programmer
programmer
Posts: 156
Joined: Mon May 23, 2005 9:46 am
Location: Prague, Czech Republic
Contact:

Post by Jenda » Sun Nov 20, 2005 12:34 pm

Edit: I'll paste it in the Ubuntu pastebin:

xmodmap.dvorak: http://paste.ubuntulinux.nl/4800
xmodmap.dvorakcz: http://paste.ubuntulinux.nl/4799
xmodmap -pke: http://paste.ubuntulinux.nl/4798

I didn't find anything strange. Could be my stupidity, though.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Sun Nov 20, 2005 1:54 pm

It seems odd that a lot of your shifted key codes are missing. Maybe it would be better to compare the output of the "dumpkeys" command. Another nice graphical utility for this is XKeyCaps:

http://www.jwz.org/xkeycaps/

You can use this tool to edit keys, swap keys, restore defaults of keys, and write out a keyboard map. Run the program, select your keyboard, right-click on the keys you want to manipulate. I think I'll make an RPM for this. Also, it's manual has some nice explanations of modifiers, etc:

http://www.jwz.org/xkeycaps/man.html

Jenda
programmer
programmer
Posts: 156
Joined: Mon May 23, 2005 9:46 am
Location: Prague, Czech Republic
Contact:

Post by Jenda » Sun Nov 20, 2005 2:44 pm

xkeycaps won't work, because of a bug I found mentioned somewhere, and there is no way to fix it. I don't remember the details of why, but the problem is that it won't let me right click a button. Such a stupid thing and it screws it all up.

How do I use dumpkeys?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Sun Nov 20, 2005 3:14 pm

Hmmm, I just used xkeycaps without a problem. I also just built an RPM for it. For dumpkeys just type "dumpkeys". You can redirect the output to a file with a working setup and also with the non-working setup. Have you tried just commenting out these lines?

Code: Select all

clear Mod1
clear Mod2
keycode 116 = Mode_switch
keycode 117 = Multi_key
add Mod1 = Alt_L
add Mod2 = Mode_switch
Use an "!" in the first column to comment.

Jenda
programmer
programmer
Posts: 156
Joined: Mon May 23, 2005 9:46 am
Location: Prague, Czech Republic
Contact:

Post by Jenda » Mon Nov 21, 2005 8:42 am

OK: In the end I got xkeycaps working. It's a bug concerning Numlock, and for some reason it didn't work to just press Numlock before - now it did.

With that, I managed to create the proper settings. Done. Finito. Everything works. I thank you for your help - and patience. I will never have another god before you. Or at least not more than five or so.

Post Reply