# How to create a keyboard configuration file in Spanish in X.Org?



## teo (Dec 1, 2014)

Hi.

How can I create a keyboard configuration file for hald called x11-input.fdi and saved in the /usr/local/etc/hal/fdi/policy directory? This file should contain the following lines:

I'm reading the FreeBSD handbook.  I can not.  https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/x-config.html


----------



## asteriskRoss (Dec 1, 2014)

I don't use x11/hal so can't help you there (I use devd) but I set my keyboard layout in /etc/X11/xorg.conf, using the XkbModel, XkbLayout, XkbVariant options.  Have a look at the XKB configuration guide.

For a list of all available options run `less /usr/local/share/X11/xkb/rules/base.lst`.  I see that es and latam would both be valid XkbLayout values for Spanish keyboards.


----------



## asteriskRoss (Dec 1, 2014)

A quick search revealed this guide for configuring HAL on Solaris. I see you need the same options but configured in an XML file rather than /etc/X11/xorg.conf.  The HAL setup should be the same in FreeBSD, though obviously the Solaris system commands differ.


----------



## teo (Dec 1, 2014)

LATAM means latin, and Spanish means spanish, its keyboard variables are different.


----------



## olivierd (Dec 2, 2014)

I don't use x11/hal (I use rather devd), but you can find everything in /usr/local/share/X11/xkb/rules/base.lst. First, create the /etc/X11/xorg.conf.d directory: `mkdir /etc/X11/xorg.conf.d`. Then, create 10-keyboard.conf (Xorg reads .conf files in arithmetic order).

```
Section "InputDevice"
  Identifier "Keyboard0"
  Driver "kbd"
  Option "XkbModel" "pc105" # or pc104
  Option "XkbRules" "xorg"
  Option "XkbLayout" "es"
EndSection
```
In base.lst choose model, layout and if you need it variant layout (XkbVariant option). Below is an excerpt for a Spanish layout.


nodeadkeys  es: Spanish (eliminate dead keys)
winkeys  es: Spanish (Winkeys)
deadtilde  es: Spanish (include dead tilde)
sundeadkeys  es: Spanish (Sun dead keys)
dvorak  es: Spanish (Dvorak)
ast  es: Asturian (Spain, with bottom-dot H and bottom-dot L)
cat  es: Catalan (Spain, with middle-dot L)
mac  es: Spanish (Macintosh)


----------



## teo (Dec 2, 2014)

Is it necessary to add that to base.lst?


----------



## olivierd (Dec 2, 2014)

teo said:


> That it is necessary to add on  base.lst ?


No, base.lst inventories different layouts. You must only choose the one that matches your Spanish keyboard.


----------



## asteriskRoss (Dec 2, 2014)

Edit: olivierd beat me to it 



teo said:


> LATAM means latin, and Spanish means spanish, its keyboard variables are different.


I didn't want to assume which flavour of Spanish you speak 



teo said:


> That it is necessary to add on  base.lst ?


No, if you're using x11/hal you need to create the file /usr/local/etc/hal/fdi/policy/x11-input.fdi with the content something like:

```
<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
  <device>
    <match key="info.capabilities" contains="input.keys">
      <merge key="input.x11_options.XkbRules" type="string">base</merge>
      <merge key="input.x11_options.XkbModel" type="string">pc105</merge>
      <merge key="input.x11_options.XkbLayout" type="string">es</merge>
      <merge key="input.x11_options.XkbVariant" type="string">winkeys</merge>
    </match>
  </device>
</deviceinfo>
```


----------



## teo (Dec 2, 2014)

asteriskRoss said:


> x11/hal you need to create the file /usr/local/etc/hal/fdi/policy/x11-input.fdi with the content something like:
> 
> ```
> 
> ...



olivierd: I did what you said and did not work.

asteriskRoss: can you specify how to create the directory /usr/local/etc/hal/fdi/policy/x11-input.fdi? The variable for the Spanish keyboard is es, and the variable for the LATAM keyboard is la. Localization of language is ISO-8859-15, and es_ES.ISO8859-15 or es_ES.UTF-8, thanks for the replies.


----------



## olivierd (Dec 2, 2014)

x11/hal is deprecated (not maintained anymore). I don't know why it's still in the ports tree .

teo, try to build x11-servers/xorg-server from ports and choose the devd option.


----------



## asteriskRoss (Dec 2, 2014)

/usr/local/etc/hal/fdi/policy/x11-input.fdi should be a file, not a directory.  You can create it using a text editor such as ee(1) or vi(1) from the console.  If you're not already familiar with vi(1), then ee(1) is easier to use.  I am not sure whether the /usr/local/etc/hal/fdi/policy directory is created when x11/hal is installed so my instructions include creating it, just in case.

As root, run `mkdir -p /usr/local/etc/hal/fdi/policy`.
As root, run `ee /usr/local/etc/hal/fdi/policy/x11-input.fdi`.
Type in the contents of the XML file from my previous post.
Press Escape to bring up the editor menu.
Press Enter to choose the first option and leave the editor.
Choose to save the file when prompted.


----------



## teo (Dec 3, 2014)

There's no port with  x11/hal. At  the beginning of this thread. How can I create a keyboard configuration file for hald called x11-input.fdi and saved in the /usr/local/etc/hal/fdi/policy directory? This file should contain the following lines:


----------



## asteriskRoss (Dec 3, 2014)

teo said:


> No port with  x11/hal.


hald is the HAL daemon, installed as part of x11/hal.


teo said:


> This file should contain the following lines:


I am confused as I do not see any lines in your last post or the first post in the thread.


----------



## teo (Dec 4, 2014)

What should I do? This is confusing, thanks for your patience.


----------



## asteriskRoss (Dec 4, 2014)

Boot to FreeBSD.
Press Ctrl + Alt + F2 to switch to a console.
Login as root.
Run this command: `mkdir -p /usr/local/etc/hal/fdi/policy`.
Run this command: `ee /usr/local/etc/hal/fdi/policy/x11-input.fdi`.
Enter the following:

```
<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
<device>
<match key="info.capabilities" contains="input.keys">
<merge key="input.x11_options.XkbRules" type="string">base</merge>
<merge key="input.x11_options.XkbModel" type="string">pc105</merge>
<merge key="input.x11_options.XkbLayout" type="string">es</merge>
<merge key="input.x11_options.XkbVariant" type="string">winkeys</merge>
</match>
</device>
</deviceinfo>
```

Press Escape (this shows the menu).
Press Enter (this chooses the first option; leave editor).
Press Enter (this chooses the first option; save changes).
Run this command: `shutdown -r now`.


----------



## teo (Dec 4, 2014)

An excerpt for a Spanish layout is not shown, for example:

nodeadkeys es: Spanish (eliminate dead keys)
winkeys es: Spanish (Winkeys)
deadtilde es: Spanish (include dead tilde)
sundeadkeys es: Spanish (Sun dead keys)
dvorak es: Spanish (Dvorak)
ast es: Asturian (Spain, with bottom-dot H and bottom-dot L)
cat es: Catalan (Spain, with middle-dot L)
mac es: Spanish (Macintosh)

Also I have problems with language localization in a variable LC_ALL=, thanks for the help.  


```
[cmd=%]locale[/cmd]
LANG=es_ES.ISO8859-15
LC_CTYPE="es_ES.ISO8859-15"
LC_COLLATE="es_ES.ISO8859-15"
LC_TIME="es_ES.ISO8859-15"
LC_NUMERIC="es_ES.ISO8859-15"
LC_MONETARY="es_ES.ISO8859-15"
LC_MESSAGES="es_ES.ISO8859-15"
LC_ALL=
%
```


----------



## Martillo1 (Dec 8, 2014)

The Spanish layout is 'es'. You do not need to specify any variant.

Do not worry about LC_ALL. See the Chapters _23.2.1.1. Login Classes Method_ and _23.2.2. Console Setup_ in the Handbook. In my .xinitrc I have this line before invoking the WM:

```
setxkbmap -model pc105 -layout es -option terminate:ctrl_alt_bksp &
```


----------



## tingo (May 24, 2015)

Thanks for mentioning the XKB Configuration guide. I just set up my laptop, using devd-based device detection for Xorg (finally - a good replacement for HAL) and struggled a bit with setting up a national keyboard layout in /etc/X11/xorg.conf. I added this section and got a working "no" layout:

```
Section "InputClass"
  Identifier "keyboard defaults"
  MatchIsKeyboard "on"
  Option  "XkbLayout" "no"
EndSection
```


----------

