# Change keyboard layout?



## fredvs (Jul 30, 2015)

Hello.

I have successfully install FreeBSD 10 + Xorg-minimal + JWM + sound + web-access. ;-)

I block on how to change the keyboard layout.

The default is English US.

Running `kbdmap` in console is working.
I was able to choose a other layout and did enter.

Sadly, the layout did not change, it is still English US.

What did I forget to do ?

Thanks.

Fre;D


----------



## taz (Jul 31, 2015)

x11/setxkbmap

`setxkbmap [I]xkb_layout[/I]`


----------



## fredvs (Aug 1, 2015)

taz => many thank for helping.
I will test it and give feedback.

Fre;D


----------



## fredvs (Aug 2, 2015)

Hello.

I have try with `setxkbmap [I]xkb_layout[/I]`
Without luck. ;-)
I get error message about wrong kb_layout and i do not know what to write.

Running `kbdmap` in console gives this =>







After  `< OK >`, it comes back to clear console but the keyboard layout did not change.

Thank to help.

Fred.


----------



## srobert (Aug 3, 2015)

`kbdmap` is for the console.  `setxkbmap` is the utility you want for X11. 
`setxkbmap pt` or `setxkbmap br` may be what you want.


----------



## fredvs (Aug 3, 2015)

srobert said:


> kbdmap is for the console.  setxkbmap is the utility you want for X11.
> setxkbmap pt or  setxkbmap br may be what you want.



Hello and thank for help.

I  will try.
But it does not solve the choosing.
Does  it exist a program for x that does the same thing than `kbdmap` ?
Or where is stored the choice done by `kbdmap` to use it for `setxbmap` ?

Thanks.


----------



## fredvs (Aug 3, 2015)

srobert said:


> setxkbmap pt or  setxkbmap br may be what you want.



Yep, that works, many thanks.

Now how to link `kbdmap` to use it for `setxbmap` ?

Thanks.


----------



## srobert (Aug 4, 2015)

fredvs said:


> Hello and thank for help.
> But it does not solve the choosing.
> Does  it exist a program for x that does the same thing than `kbdmap` ?
> Or where is stored the choice done by `kbdmap` to use it for `setxbmap` ?
> ...



Most of the desktop environments, such as KDE, GNOME, XFCE etc. have graphical menus for selecting keyboard layouts. I don't think there's something for JWM specifically. But you could set up a command like `exec setxkbmap pt &` in your ~/.xinitrc  (or perhaps ~/.xsession). Or you could configure it in xorg.conf or xorg.conf.d/input.conf.


----------



## fredvs (Aug 4, 2015)

Hello and thanks for answer.


srobert said:


> exec setxkbmap pt & in your ~/.xinitrc (or perhaps ~/.xsession). Or you could configure it in xorg.conf or xorg.conf.d/input.conf.



Yep, this if you already know what keyboard you want ;-)

Maybe, after running `kbdmap`, a config file is created somewhere.
I will search for this file and use it to define the keyboard layout to use.
Then `setxkbmap kb_layout_of_kbdmap`

Thanks.


----------



## cpm@ (Aug 4, 2015)

A way to change the keymap is to use the kbdmap(1) command from a virtual console and you will presented with a similar graphical user interface for choosing a keymap. The kbdmap command, however, does not write anything to /etc/rc.conf, so if you reboot FreeBSD, the keymap will be set back to whatever /etc/rc.conf specifies, or the standard default.

So read the FreeBSD Handbook to know how to specify your language environment:
https://www.freebsd.org/doc/handbook/using-localization.html


----------



## BsDjUsTbSd (Jun 8, 2020)

i know this post is old but i am posting the answer for anyone who is looking at this anyways

setxkbmap -option 'grp:alt_shift_toggle' -layout first-layout,second-layout,third-layout                            #replace layout with us or gr or de and then shift alt will shuffle through the layout


----------



## uunnxx (Dec 30, 2020)

BsDjUsTbSd said:


> i know this post is old but i am posting the answer for anyone who is looking at this anyways
> 
> setxkbmap -option 'grp:alt_shift_toggle' -layout first-layout,second-layout,third-layout                            #replace layout with us or gr or de and then shift alt will shuffle through the layout


Yep, and you can specify variants too:
`setxkbmap -layout us,us -variant ,dvp -option grp:alt_space_toggle`
This command will set two us keyboard layout: 1st standard us layout, and 2nd dvorak programmer layout.


----------

