1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

changing keyboard layout

Discussion in 'General' started by bbzz, Dec 1, 2010.

  1. bbzz

    bbzz New Member

    Messages:
    867
    Likes Received:
    0
    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.
     
  2. graudeejs

    graudeejs Member

    Messages:
    4,594
    Likes Received:
    0
    I use: setxkbmap(1) Comes with Xorg.
    To switch to my native lang I run
    $ setxkbmap lv
    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
     
  3. jotawski

    jotawski New Member

    Messages:
    198
    Likes Received:
    1
    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:
    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:
    <?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.
     
  4. bbzz

    bbzz New Member

    Messages:
    867
    Likes Received:
    0
    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
     
  5. Beastie

    Beastie Member

    Messages:
    1,916
    Likes Received:
    1
    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:
    љњертзуиопшђасдфгхјклчћжџцвбнм
    In the same way, by running
    % setxkbmap us
    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.
     
  6. graudeejs

    graudeejs Member

    Messages:
    4,594
    Likes Received:
    0
    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)
     
  7. bbzz

    bbzz New Member

    Messages:
    867
    Likes Received:
    0
    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.
     
  8. bbzz

    bbzz New Member

    Messages:
    867
    Likes Received:
    0
    Where do I input that exactly?
     
  9. graudeejs

    graudeejs Member

    Messages:
    4,594
    Likes Received:
    0
    Depends on your desktop environment.... for light-width desktop It's easy
    add to your ~/.xinitrc
    Code:
    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:
    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
    
     
  10. bbzz

    bbzz New Member

    Messages:
    867
    Likes Received:
    0
    Nevermind! Got it.
    Still no luck with Latin letters. What Beastie typed are cyrilic.
     
  11. graudeejs

    graudeejs Member

    Messages:
    4,594
    Likes Received:
    0
    Probably most important fonts are junicode, webfonts, gnu-unifont-ttf
     
  12. bbzz

    bbzz New Member

    Messages:
    867
    Likes Received:
    0
    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.
     
  13. graudeejs

    graudeejs Member

    Messages:
    4,594
    Likes Received:
    0
    You can set environment before starting OOO (you can write small sh wrapper script)


    UTF-8 is still a way to go
     
  14. Beastie

    Beastie Member

    Messages:
    1,916
    Likes Received:
    1
    For the latinica maybe the easiest way is to setup a "compose" key by adding setxkbmap -option compose:rwin (before the WM of course) to ~/.xinitrc. This will set the right "Windows" key as a "compose" key. E.g.:
    Code:
    rwin > - > D = Đ
    rwin > v > z = ž
    
    N.B. none of the three keys are held down.