e

Toggle Between Two Keyboard Layouts

This tip lets you switch quickly between two keyboard maps (languages).


setxkbmap is a tool to query and change the current XKB map. It is included in the package x11-xkb-utils which you can find in the repository.

Once setxkbmap is installed, run the following command in the terminal:

setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,ca

This command sets the key combination Alt-Shift to toggle the key map between us and ca (I am from Québec). For me it is inconvenient to run that command manually each time I want to switch between layouts. The solution is to create a .desktop file that includes that command. The .desktop file becomes an executable “application” that can be placed with the other .desktop files in the /usr/share/applications folder.

Here is the complete .desktop file, called “Keyboard-toggle.desktop”

[Desktop Entry]
Name=Keyboard-toggle
GenericName=Keyboard-toggle
Comment=Toggle between 2 layouts with Alt-Shift
Encoding=UTF-8
Exec=setxkbmap -option grp:switch,grp:alt_shift_toggle,grp_led:scroll us,ca
Icon=
Terminal=false
Type=Application
Categories=
StartupNotify=false

After placing the .desktop file in the /usr/share/applications folder, you must add the file to the commands that run automatically when Bodhi starts up. To accomplish this, go to the Apps tab of the Settings panel, select Startup Applications, find keyboard-toggle in the list on the left, and add it to the list on the right.
If you want a key combo other than Alt-Shift, here are a few:
Options for switches between languages

  • GRP: toggle - switch Right Alt
  • GRP: shift_toggle - two keys shift
  • GRP: ctrl_shift_toggle - Ctrl + shift
  • GRP: alt_shift_toggle - Alt + shift
  • GRP: ctrl_alt_toggle - Ctrl + Alt
  • GRP: caps_toggle - switching on CapsLock
  • GRP: lwin_toggle - switch on the left “Win” key on a Windows keyboard
  • GRP: rwin_toggle - switching to the right “Win” key on a Windows keyboard
  • GRP: menu_toggle - switching on the “Shortcut Menu”
  • grp: lctrl_toggle switch on the left Control key
  • grp: rctrl_toggle switch on the right Control key
  • GRP: Switch - switch on the right Alt key only when you press
  • GRP: lwin_switch - switch on the left key, Windows only at the time of pressing
  • GRP: rwin_switch - switching by right-clicking on Windows only at the time of pressing
  • GRP: win_switch - Switch to any key, Windows only at the time of pressing

Possible values grp_led:

  • grp_led - use the indicators on the keyboard to change the testimony of layout change
  • grp_led: Num - Num_Lock indicator shows the changes of layout
  • grp_led: Caps - Caps_Lock indicator shows a change of layout
  • grp_led: scroll - Scroll_Lock indicator shows a change of layout

User Feedback

toggle_between_two_keyboard_layouts
Did you find this article helpful?
Yes, right on the money!
 
45%(34)
Somewhat. Needs work.
 
24%(18)
Not really
 
1%(1)
Not at all.
 
30%(23)

If you would like to comment or make further suggestions, please leave a note on our Comments page (you will have to Create an Account if you haven't already).

 
keyboard_-_toggle_between_2_layouts.txt · Last modified: 2011/05/15 19:15 by ottermaton · [Old revisions]


© Copyright Bodhi Linux 2012. All Rights Reserved - Hosted by vaultnetworks