# Keyboard layout problems



## Dinchamion (Nov 23, 2009)

Hello,

I'm a long-time linux user just migrating to FreeBSD, so please be patient. 

My problem is (well, one of my problems is) that I can't seem to set the keyboard layout permanently in X. I installed and configured FreeBSD just fine, installed X with some minimal problems (I'm still sorting those out, no major issues though), but this problem seems to elude me and it's starting to drive me crazy.

My keyboard layout should be Hungarian, and in console, it actually is. However any time I start X, it switches to us. I googled the issue and tried out like a million suggestions, but I still have no idea why it won't work.

As a real newbie to FreeBSD, I have no idea what kind of log output I should include here, so please bear with me, and tell me which ones you need to help me.

Thank you in advance!


----------



## graudeejs (Nov 23, 2009)

depends on how you start X (do you use startx, xdm, gnome, kde etc..)

The one of simple solutions is, if you start X with startx, then simply add 

```
setxkbmap hu &
```
to ~/.xinitrc
before executing your Window Manager

If you use some window manager you just need to add setxkbmap hu to configuration, so it would be executed every time your Window Manager is started


P.S.
Personally I even have link from ~/.xsession to ~/.xinitrc, this is useful if you use xdm, because it will execute xsession (if i remember corectly), gdm also can execute ~/.xsession.

Remember ~/.xinitrc and ~/.xsession are read and executed as sh scripts


----------



## Mordy (Nov 23, 2009)

I too have linked from ~/.xsession to ~/.xinitrc and found it to be more beneficial for then you are able to execute xsession.


----------



## SPlissken (Nov 25, 2009)

Personnaly , i m french , to have french keyboard layout i added this line in xorg.conf :


```
Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "kbd"
        [B]Option "Xkblayout" "fr"[/B]
EndSection
```

May be you have to do same with 'hu'


----------



## Dinchamion (Nov 25, 2009)

Weird part is, this is the stuff I did... First I tried with xorg.conf, no go. Then with .xinitrc, same problem.

But I'll start over from scratch, with more attention and maybe with more luck.

Thanks all!


----------



## FRANCOIS (Nov 25, 2009)

I gather you're using freebsd7.2:
In a terminal:

```
echo 'hald_enable="YES"' >> /etc/rc.conf
echo 'dbus_enable="YES"' >> /etc/rc.conf
```
create a file x11-input.fdi:

```
# touch x11-input.fdi
```
then add this content in it:

```
# vi x11-input.fdi
```


```
<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
  <device>
    <match key="info.capabilities" contains="input.keyboard">
      <merge key="input.x11_options.XkbModel" type="string">pc105</merge>
      <merge key="input.x11_options.XkbLayout" type="string">hu</merge>
    </match>
  </device>
</deviceinfo>
```
copy it to /usr/local/etc/hal/fdi/policy 

reboot


----------



## graudeejs (Nov 25, 2009)

You still haven't answered if you're using any desktop enviroment, or custom desktop.

And how do you start X?


----------

