Jump to content

dynamic keyboard layout


ramfree17
 Share

Recommended Posts

background: i bought my laptop while I was in Helsinki thus it has a finnish keyboard layout. since i find the keyset less than appealing and i do a few rounds of gaming here and there i bought a compact usb keyboard here in Manila. the usb keyboard is recognized and usable but the keys are set for US international and to save space the non-alphabet keys are placed in different area.

 

is there an app or utility in X that will allow me to change the keyboard layout dynamically without requiring a restart of the X server? something with shortcuts would be excellent since i need something that will allow me or my wife to configure the input depending if we are using the usb kb or the built-in one.

 

thanks.

 

ciao!

Link to comment
Share on other sites

Of course!

If you're using KDE, go to Start -> System -> Configuration -> KDE -> Regional & Accessibility -> Keyboard layout and select the layouts you want to add to the list. You can also choose the switching options if you want.

By default you can switch layouts with Ctrl-Alt-k or by clicking on the taskbar icon with the flag,.

 

If you're using gnome, dunno :D

Link to comment
Share on other sites

You can leave both keyboards plugged in and just set the keymap in the relevant stanza for xorg.conf

Option "XkbLayout" "<code>"

but you then need to identify the keyboards

 

cat /dev/input/event0

should show the first keyboard

 

see something like

 

 

ls /dev/input/

by-path event0 event1 event2 mice mouse0 ts0

 

so now you need 2x keyboard stanza's using the correct /dev/input for each

 

Section "InputDevice"

Identifier "Keyboard0"

Driver "keyboard"

# this is for supporting deadkeys

Option "XkbRules" "xfree86"

Option "XkbModel" "aa"

Option "XkbLayout" "aa"

EndSection

 

Section "InputDevice"

Identifier "Keyboard1"

Driver "keyboard"

Option "Protocol" "usbev"

Option "Device" "/dev/input/event0"

Option "XkbModel" "xx"

Option "XkbLayout" "xx"

 

EndSection

Link to comment
Share on other sites

bummer, gowator's xorg.conf did not work (or i am not doing it properly). i added these lines

 

Section "InputDevice"
Identifier "Keyboard2"
Driver "kbd"
Option "Protocol" "usbev"
Option "Device" "/dev/input/event3"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
Option "XkbOptions" "compose:rwin"
EndSection

Section "ServerLayout"
Identifier "layout1"
InputDevice "Keyboard1" "CoreKeyboard"
InputDevice "Keyboard2" "CoreKeyboard"  # <-- Added line
InputDevice "Mouse1" "CorePointer"
InputDevice "Mouse2" "SendCoreEvents"
InputDevice "SynapticsMouse1" "AlwaysCore"
Screen "screen1"
EndSection

 

and restarted the X server but nothing happened. i took a peek at neddie's suggestion and got an insight on how to use setxkbmap properly (meaning the correct values for the -model and -layout options) so i am good with fluxbox. i just created aliases for the two kb layouts. the two separate kb would be sweet though. :thumbs:

 

ciao!

Link to comment
Share on other sites

You can have 1 and only one core keyboard... btw

Most of what I wrote was based on doing the opposite, ie having several heads and a keyb/mouse on each ...

Google seems to have lots of info on this.way.. but using more than one keyboard is done everyday by laptop owners with external keyb's... obviously a WM that takes control of the keyb is going to mess stuff up so with KDE you would have to remove the KDE keyboard tool thingy..... but overall everything seems to be there to do this and I intend to try myself...

Link to comment
Share on other sites

Sounds good

As I said I think you will need to have recognizably different keyboard models. All of them being PC105 would start having those issues. You would need to buy something like a 102, 104, and a 105. It has to be recognized as a fully seperate model upon being recognized for what I am suggesting to work(I think.) That may only be the way I understand current X to work, but I have a friend who has that working with 2 keyboards, but they are recognizably different(to the OS), and that may be the key.

Is I guess where

 

Option "Device" "/dev/input/event0"

 

comes in....

 

However having one PS2 and one USB should help identify them ....

 

It might need some poking about in the modules, perhaps adding an alias so they are always loaded as the same thing? In theory it looks good ... but probably takes a fair bit of experimentation..

Link to comment
Share on other sites

:wall: this is driving me nuts. :wall:

 

replaced the ServerLayout option for Keyboard2 to "SendCoreEvents"

 

i tried disabling the usbev line and the usbkeyboard works fine but the builtin is now using the us layout so no dice.

 

then i tried specifying Option "Device" "/dev/input/event0" on the built-in keyboard and returned the usbev protocol line on the USB kb, restarted X and all hell broke lose whenever i type anything.

 

removed the device option on Keyboard1 and X started fine but both kb resumed to having the finnish layout.

 

:huh:

 

ciao!

Link to comment
Share on other sites

yeah, this is the weird thing since the other day event1 was the built-in while event3 was the usb kb. last night the numbers were decreased by 1 which is why the event numbers is different on my first config post. and i used cat instead of tail. :)

 

ciao!

Ouch.. sounds like the catis chasing its tail :D

I guess we need to figure out how the events are allocated in bootup.... and then they can be aliased to always be the same...probably just in the modules.conf

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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

Loading...
 Share

×
×
  • Create New...