changing keyboard layout

General questions about the FreeBSD operating system. Ask here if your question does not fit elsewhere.

changing keyboard layout

Postby bbzz » 01 Dec 2010, 21:43

Greetings,

Can anyone help with this; I need to change my standard US layout to support Serbian (Latin only would suffice) letters. Does anyone know how can i do that, and how to switch back and forth between the two without restarting the system.
Much obliged.
bbzz
Member
 
Posts: 858
Joined: 04 Nov 2010, 01:07
Location: random

Postby graudeejs » 01 Dec 2010, 21:48

I use: [man=1]setxkbmap[/man] Comes with Xorg.
To switch to my native lang I run
[cmd=$]setxkbmap lv[/cmd]
Be aware, that If you switch to lang, that doesn't have latin characters, then you won't be able to type setxkbmap again to switch back...

I eliminated this problem by making custom fvwm menu for language switching. Also to switch languages faster, I assigned fvwm key bindings to switch between latvian and russian languages :D
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby jotawski » 02 Dec 2010, 04:24

Hi,

Just for your informations, I used to ask here about thai keyboard layout switching too. But I forgot where it is now. Please have a look at hal and fdi for keywords.

Another way is using xorg.conf. Also I got suggestion from this forum. I have attched my xorg.conf for switching from thai to english with this post too.

Sorry, I can not attach file but here it is

Code: Select all
Section "ServerLayout"
   Identifier     "X.org Configured"
   Screen      0  "Screen0" 0 0
   Screen      1  "Screen1" RightOf "Screen0"
   InputDevice    "Mouse0" "CorePointer"
   InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
   ModulePath   "/usr/local/lib/xorg/modules"
   FontPath     "/usr/local/lib/X11/fonts/misc/"
   FontPath     "/usr/local/lib/X11/fonts/TTF/"
   FontPath     "/usr/local/lib/X11/fonts/OTF"
   FontPath     "/usr/local/lib/X11/fonts/Thai/"
   FontPath     "/usr/local/lib/X11/fonts/local/"
   FontPath     "/usr/local/lib/X11/fonts/util/"
   FontPath     "/usr/local/lib/X11/fonts/bitstream-vera/"
   FontPath     "/usr/local/lib/X11/fonts/texcm-ttf/"
   FontPath     "/usr/local/lib/X11/fonts/Type1/"
   FontPath     "/usr/local/lib/X11/fonts/100dpi/"
   FontPath     "/usr/local/lib/X11/fonts/75dpi/"
   FontPath     "/usr/local/lib/X11/fonts/TrueType/"
   FontPath     "/usr/local/lib/X11/fonts/webfonts/"
   FontPath     "/usr/local/lib/X11/fonts/urwfonts-ttf/"
   FontPath     "/usr/local/lib/X11/fonts/URW/"
   FontPath     "/usr/local/share/fonts/amspsfont/type1/"
   FontPath     "/usr/local/share/fonts/cmpsfont/type1/"
   FontPath     "unix/:7101"
EndSection

Section "Module"
   Load  "extmod"
   Load  "record"
   Load  "dbe"
   Load  "glx"
   Load  "dri"
   Load  "dri2"
   Load  "freetype"
   Load  "type1"
EndSection

Section "InputDevice"
   Identifier  "Keyboard0"
   Driver      "kbd"
#   Option   "XkbRules" "xorg"
#   Option   "XkbModel"   "pc105"
#   Option   "XkbLayout"   "us,th"
#   Option   "XkbOptions"   "grp:ctrl_shift_toggle"
###
   Option   "XkbRules" "xorg"
   Option   "XkbModel"   "pc105"
   Option   "XkbLayout"   "us,th"
   Option   "XkbVariant"   "tis"
   Option   "XkbOptions"   "grp:alt_shift_toggle"
EndSection

Section "InputDevice"
   Identifier  "Mouse0"
   Driver      "mouse"
   Option       "Protocol" "auto"
   Option       "Device" "/dev/sysmouse"
   Option       "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
   Identifier   "Monitor0"
   VendorName   "Monitor Vendor"
   ModelName    "Monitor Model"
EndSection

Section "Monitor"
   Identifier   "Monitor1"
   VendorName   "Monitor Vendor"
   ModelName    "Monitor Model"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
        ### [arg]: arg optional
        #Option     "NoAccel"               # [<bool>]
        #Option     "SWcursor"              # [<bool>]
        #Option     "ColorKey"              # <i>
        #Option     "CacheLines"            # <i>
        #Option     "Dac6Bit"               # [<bool>]
        #Option     "DRI"                   # [<bool>]
        #Option     "NoDDC"                 # [<bool>]
        #Option     "ShowCache"             # [<bool>]
        #Option     "XvMCSurfaces"          # <i>
        #Option     "PageFlip"              # [<bool>]
   Identifier  "Card0"
   Driver      "intel"
   VendorName  "Intel Corporation"
   BoardName   "82852/855GM Integrated Graphics Device"
   BusID       "PCI:0:2:0"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz"
        ### [arg]: arg optional
        #Option     "NoAccel"               # [<bool>]
        #Option     "SWcursor"              # [<bool>]
        #Option     "ColorKey"              # <i>
        #Option     "CacheLines"            # <i>
        #Option     "Dac6Bit"               # [<bool>]
        #Option     "DRI"                   # [<bool>]
        #Option     "NoDDC"                 # [<bool>]
        #Option     "ShowCache"             # [<bool>]
        #Option     "XvMCSurfaces"          # <i>
        #Option     "PageFlip"              # [<bool>]
   Identifier  "Card1"
   Driver      "intel"
   VendorName  "Intel Corporation"
   BoardName   "82852/855GM Integrated Graphics Device"
   BusID       "PCI:0:2:1"
EndSection

Section "Screen"
   Identifier "Screen0"
   Device     "Card0"
   Monitor    "Monitor0"
   SubSection "Display"
      Viewport   0 0
      Depth     1
   EndSubSection
   SubSection "Display"
      Viewport   0 0
      Depth     4
   EndSubSection
   SubSection "Display"
      Viewport   0 0
      Depth     8
   EndSubSection
   SubSection "Display"
      Viewport   0 0
      Depth     15
   EndSubSection
   SubSection "Display"
      Viewport   0 0
      Depth     16
   EndSubSection
   SubSection "Display"
      Viewport   0 0
      Depth     24
   EndSubSection
EndSection

Section "Screen"
   Identifier "Screen1"
   Device     "Card1"
   Monitor    "Monitor1"
   SubSection "Display"
      Viewport   0 0
      Depth     1
   EndSubSection
   SubSection "Display"
      Viewport   0 0
      Depth     4
   EndSubSection
   SubSection "Display"
      Viewport   0 0
      Depth     8
   EndSubSection
   SubSection "Display"
      Viewport   0 0
      Depth     15
   EndSubSection
   SubSection "Display"
      Viewport   0 0
      Depth     16
   EndSubSection
   SubSection "Display"
      Viewport   0 0
      Depth     24
   EndSubSection
EndSection


And here is my /usr/local/etc/hal/fdi/policy/x11-input.fdi for additional informations.

Code: Select all
<?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">us,th</merge>
<merge key="input.x11_options.XkbOptions" type="string">grp:alt_shift_toggle</merge>
<!--
<append key="input.x11_options.XkbOptions" type="string">terminate:ctrl_alt_bksp</append>
-->
</match>
</device>
</deviceinfo>


hope this helps.
best regards,
jotawski

http://makham.blogspot.com FreeBSD for thai
User avatar
jotawski
Member
 
Posts: 198
Joined: 18 Nov 2008, 11:04
Location: park kred/nontabury/thai

Postby bbzz » 07 Dec 2010, 16:46

I finally got to try this (was stuck on win machine for a few days)...
$ setxkbmap rs

Which gives me ?????? no matter what i type.
After little bit of search i found that i need to do something with sr_YU.ISO8859-2 in order to see those letters. I see those files in /usr/local/share/nls, /usr/local/lib/X11/fonts/..., etc. What do i do with it, and how I do it in most painless way so I can revert back to US keymap without restarting Xorg?

Thanks again
bbzz
Member
 
Posts: 858
Joined: 04 Nov 2010, 01:07
Location: random

Postby Beastie » 07 Dec 2010, 18:31

bbzz wrote:$ setxkbmap rs

Which gives me ?????? no matter what i type.

Where are you trying?
The application must support the fonts. If I open Leafpad, for example, I'm able to type the Serbian alphabet:
Code: Select all
љњертзуиопшђасдфгхјклчћжџцвбнм


bbzz wrote:how I do it in most painless way so I can revert back to US keymap without restarting Xorg?

In the same way, by running
[cmd=%]setxkbmap us[/cmd]
But that would be quite difficult with your current keymap hehe. So, like killasmurf86 already said, you add both to your window manager's root menu.
May the source be with you!
Beastie
Senior Member
 
Posts: 1861
Joined: 28 Mar 2009, 11:27
Location: /dev/earth0

Postby graudeejs » 07 Dec 2010, 18:41

try sr_YU.UTF-8
Everyone and everything should use Unicode by Now... even stupid Windows (Don't know if it actually supports uft-8)
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby bbzz » 07 Dec 2010, 18:44

Hi!
See, that's the thing, I probably don't have fonts installed. I see squares instead of those letter you typed i this Opera browser :e
So how do I go about installing those fonts? Seems that's the culprit of the problem.
bbzz
Member
 
Posts: 858
Joined: 04 Nov 2010, 01:07
Location: random

Postby bbzz » 07 Dec 2010, 18:48

killasmurf86 wrote:try sr_YU.UTF-8
Everyone and everything should use Unicode by Now... even stupid Windows (Don't know if it actually supports uft-8)


Where do I input that exactly?
bbzz
Member
 
Posts: 858
Joined: 04 Nov 2010, 01:07
Location: random

Postby graudeejs » 07 Dec 2010, 18:54

Depends on your desktop environment.... for light-width desktop It's easy
add to your [file]~/.xinitrc[/file]
Code: Select all
LANG="lv_LV.UTF-8"
LC_ALL="lv_LV.UTF-8"
LC_COLLATE="lv_LV.UTF-8"
LC_CTYPE="lv_LV.UTF-8"
LC_MESSAGES="lv_LV.UTF-8"
LC_MONETARY="lv_LV.UTF-8"
LC_NUMERIC="lv_LV.UTF-8"
LC_TIME="lv_LV.UTF-8"
export LANG LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME XDG_CONFIG_HOME LC_ALL

For Real desktop environments search forum about "localization", there have been many threads about it, I'm tired searching and posting links regarding this....

About fonts. I install these (pasted part of my desktop metaport)
Code: Select all
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/local/unifont.ttf:${PORTSDIR}/x11-fonts/gnu-unifont-ttf
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/junicode:${PORTSDIR}/x11-fonts/junicode
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/terminus-font:${PORTSDIR}/x11-fonts/terminus-font
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/Droid:${PORTSDIR}/x11-fonts/droid-fonts-ttf
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/ecofont:${PORTSDIR}/x11-fonts/ecofont
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/code2001:${PORTSDIR}/x11-fonts/code2001
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/dejavu:${PORTSDIR}/x11-fonts/dejavu
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/freefont-ttf:${PORTSDIR}/x11-fonts/freefont-ttf
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/gentium:${PORTSDIR}/x11-fonts/gentium
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/Khmer:${PORTSDIR}/x11-fonts/khmeros
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/lfpfonts-fix:${PORTSDIR}/x11-fonts/lfpfonts-fix
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/lfpfonts-var:${PORTSDIR}/x11-fonts/lfpfonts-var
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/mgopen:${PORTSDIR}/x11-fonts/mgopen
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/mozilla:${PORTSDIR}/x11-fonts/mozilla-fonts
# restricted fonts
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/webfonts:${PORTSDIR}/x11-fonts/webfonts
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby bbzz » 07 Dec 2010, 18:55

Nevermind! Got it.
Still no luck with Latin letters. What Beastie typed are cyrilic.
bbzz
Member
 
Posts: 858
Joined: 04 Nov 2010, 01:07
Location: random

Postby graudeejs » 07 Dec 2010, 18:58

Probably most important fonts are junicode, webfonts, gnu-unifont-ttf
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby bbzz » 07 Dec 2010, 18:59

killasmurf86 wrote:Depends on your desktop environment.... for light-width desktop It's easy
add to your [file]~/.xinitrc[/file]
Code: Select all
LANG="lv_LV.UTF-8"
LC_ALL="lv_LV.UTF-8"
LC_COLLATE="lv_LV.UTF-8"
LC_CTYPE="lv_LV.UTF-8"
LC_MESSAGES="lv_LV.UTF-8"
LC_MONETARY="lv_LV.UTF-8"
LC_NUMERIC="lv_LV.UTF-8"
LC_TIME="lv_LV.UTF-8"
export LANG LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME XDG_CONFIG_HOME LC_ALL

For Real desktop environments search forum about "localization", there have been many threads about it, I'm tired searching and posting links regarding this....

About fonts. I install these (pasted part of my desktop metaport)
Code: Select all
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/local/unifont.ttf:${PORTSDIR}/x11-fonts/gnu-unifont-ttf
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/junicode:${PORTSDIR}/x11-fonts/junicode
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/terminus-font:${PORTSDIR}/x11-fonts/terminus-font
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/Droid:${PORTSDIR}/x11-fonts/droid-fonts-ttf
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/ecofont:${PORTSDIR}/x11-fonts/ecofont
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/code2001:${PORTSDIR}/x11-fonts/code2001
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/dejavu:${PORTSDIR}/x11-fonts/dejavu
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/freefont-ttf:${PORTSDIR}/x11-fonts/freefont-ttf
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/gentium:${PORTSDIR}/x11-fonts/gentium
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/Khmer:${PORTSDIR}/x11-fonts/khmeros
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/lfpfonts-fix:${PORTSDIR}/x11-fonts/lfpfonts-fix
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/lfpfonts-var:${PORTSDIR}/x11-fonts/lfpfonts-var
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/mgopen:${PORTSDIR}/x11-fonts/mgopen
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/mozilla:${PORTSDIR}/x11-fonts/mozilla-fonts
# restricted fonts
RUN_DEPENDS+=   ${LOCALBASE}/lib/X11/fonts/webfonts:${PORTSDIR}/x11-fonts/webfonts


I will try that! Thanks.

I simply want to be able to type Serbian Latin when I work in, say OpenOffice. When I'm done I want to switch back to US. Don't want to localize my whole system. Sorry, should've been more precise.
bbzz
Member
 
Posts: 858
Joined: 04 Nov 2010, 01:07
Location: random

Postby graudeejs » 07 Dec 2010, 19:23

You can set environment before starting OOO (you can write small sh wrapper script)


UTF-8 is still a way to go
User avatar
graudeejs
Style(9) Addict
 
Posts: 4591
Joined: 16 Nov 2008, 23:23
Location: Riga, Latvia

Postby Beastie » 07 Dec 2010, 21:30

bbzz wrote:Still no luck with Latin letters. What Beastie typed are cyrilic.

For the latinica maybe the easiest way is to setup a "compose" key by adding [noparse]setxkbmap -option compose:rwin[/noparse] (before the WM of course) to [file]~/.xinitrc[/file]. This will set the right "Windows" key as a "compose" key. E.g.:
Code: Select all
rwin > - > D = Đ
rwin > v > z = ž

N.B. none of the three keys are held down.
May the source be with you!
Beastie
Senior Member
 
Posts: 1861
Joined: 28 Mar 2009, 11:27
Location: /dev/earth0


Return to General

Who is online

Users browsing this forum: No registered users and 3 guests