-   Slackware (
-   -   Changing keyboard mapping for xterm in xwindow (

stting 07-09-2004 10:10 PM

Changing keyboard mapping for xterm in xwindow

I am wondering whether it is possible to remap the keyboard for only a single instance of a terminal (i.e. xterm) in xwindows?

I have my keyboard set to dvorak in general, but a certain application requires me to use the qwerty layout because of the arrangement of keys. What I want to do is be able to just start xterm and enter some command to change the layout for that xterm so that any subsequent applications run from that terminal use the qwerty layout. However, all other windows in X and the other consoles should still use the dvorak layout.

Is this possible?


marlor 07-11-2004 01:08 PM


what you need to do is to edit your xfree or xorg.conf which is located in /etc/X11/

there you will kind this section:


# **********************************************************************
# Core keyboard's InputDevice section
# **********************************************************************

under that that you should have something like:


Section "InputDevice"
    Identifier        "Keyboard1"
    Driver        "Keyboard"
    Option    "XkbLayout"    "be"


if "Option "XkbLayout" " has a # infront of it, then remove it

my keyboard is azerty which is belgian keyboard which makes it "be"

what you have to do is change the "be" to your country code. as i remember default was "us"

good luck

stting 07-11-2004 03:29 PM

Yes, I have done that already. I am able to get X to run with the dvorak keyboard layout. However, what I want to be able to do is open up a terminal window in X (that currently uses the dvorak layout), run a command to change only _that_ terminal to a qwerty layout, and then be able to run a program from that terminal using the qwerty layout while the rest of X uses the dvorak layout. I don't want to have to edit the file and restart X.

Hope this makes sense.


keefaz 07-11-2004 04:56 PM

What is the program which need qwerty keyboard, just curious.

stting 07-11-2004 05:04 PM

Oh, they are FPS games, namely America's Army and Wolfenstein: Enemy Territory. Some newer games automatically remap the keys if you are in a different layout, but not these. In principal, I can manually relay all the keybindings in the game, but I'd rather not do that.

motub 07-11-2004 06:10 PM

Pardon my ignorance, but wouldn't it be easier to just change the keybindings in the game itself? I'd be very surprised if these two games did not allow custom keys to be chosen by the player for switching weapons, moving around, etc.

cerrayon 07-11-2004 07:11 PM

Yes, as I mentioned in the previous post, that is one way to do it. All I'm wondering is if there's a simpler way rather than manually changing all keybindings within the game.

motub 07-11-2004 08:45 PM

Well, I think that's what I was asking; how is it simpler to 1) get xterm to specify a specific instance (the one where you're playing the game, rather than the one where you're installing something with pkgtool or whatever else one might do in an xterm), and then 2) change the keyboard layout for that instance and 3) pass the changed layout to the program running in the Xterm (which may not even accept this action), than it is to 1) change the configuration of the keys in the application once? Unless of course, you play these games with both kinds of keyboard, so you'd need to switch them, depending on which keyboard you happened to be using at the time.

Perhaps you could write a short script to start these games. One which would either start the game in a new instance of X that used a different configuration file (changing the keyboard), or one which exported the keyboard map variable before starting the game.

Just an idea, as I have never had to change my keyboard map on the fly, or for a limited period, but maybe it will help.

All times are GMT -5. The time now is 02:17 PM.