Switch Keyboard layout

From Fluxbox-wiki

Jump to: navigation, search

to switch keyboard layout in fluxbox you must take some effect and carefully read XKB Configuration . also you need to know which name have your language layout and which Variant name (if you use Variant). first configure your xorg.conf must correctly setting:


 # /etc/X11/xorg.conf

for example i use Danish (dk) keyboard layout and Iraq(iq) Kurdish-Arabic-Latin Variant(ku_ara):

Option		"XkbLayout"	"dk,iq"
Option		"XkbVariant"	",ku_ara"

more info about your keyboard layout

# cat /usr/share/X11/xkb/rules/base.lst | grep -i <YOURCOUNTRYCODE>
  • Input hotplugging with HAL (like in Archlinux)

X will utilize hal to allow for the hotplugging and removal of human interface devices without having to restart X. The configuration should look like:

<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- -->
<deviceinfo version="0.2">
  <device>
    <match key="info.capabilities" contains="input.keymap">
      <append key="info.callouts.add" type="strlist">hal-setup-keymap</append>
    </match>

    <match key="info.capabilities" contains="input.keys">
      <merge key="input.xkb.rules" type="string">base</merge>

      <!-- If we're using Linux, we use evdev by default (falling back to
           keyboard otherwise). -->
      <merge key="input.xkb.model" type="string">keyboard</merge>
      <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
             string="Linux">
        <merge key="input.xkb.model" type="string">evdev</merge>
      </match>

      <merge key="input.xkb.layout" type="string">dk,iq</merge>
      <merge key="input.xkb.variant" type="string"> ,ku_ara</merge>
      <merge key="input.xkb.options" type="string">grp:alt_shift_toggle</merge>
    </match>
  </device>
</deviceinfo>
  • using UDEV and debian(debian based Distro's) style
#/etc/default/keyboard

The configuration should look like:

XKBMODEL="pc105"
XKBLAYOUT="dk,iq"
XKBVARIANT=" ,ku_ara"
XKBOPTIONS="lv3:ralt_switch,compose:lwin,grp:alt_shift_toggle"

and to create small script to make switch keyboard simply and user friendly

#vim /home/<YOURUSERNAME>/.fluxbox/menu

this file content:

[begin] (fluxbox)
[include] (/etc/X11/fluxbox/fluxbox-menu)
[end]

change it to this:

[begin] (fluxbox)
[include] (/etc/X11/fluxbox/fluxbox-menu)
[submenu] (Keyboards)
[exec] (dk) {setxkbmap dk}
[exec] (ku) {setxkbmap iq -variant ku_ara}
[end]

this example for Danish (dk) and Iraq (iq) kurdish-arabic-latin (ku_ara). another example for German (de) and Danish (dk) layout without Variant.

[begin] (fluxbox)
[include] (/etc/X11/fluxbox/fluxbox-menu)
[submenu] (Keyboards)
[exec] (de) {setxkbmap de}
[exec] (dk) {setxkbmap dk}
[end]

now you see the Keyboards option in fluxbox menu at the end.

Personal tools