Sunday 9 August 2009

Toggling keyboards in Xubuntu

I recently switched to Xubuntu from Ubuntu. I wanted to retain the ability to switch from ES to US keyboard by pressing my right control key. For this purpose, I created a new file at /usr/bin called togglekeyboard. The file contains:

#!/bin/bash
setxkbmap -option grp:switch,grp:rctrl_toggle us,es

us and es stand for US and Spanish keyboards. You will better know the id of your desired keyboard flavour.

Then, rctrl_toggle asks setxkbmap to toggle the keyboard on the right-control-key-pressed event. I chose this key as I am not using it for anything else. I got used to press the left control key for all properly controlish purposes. Other options that may suit you are:

  • toggle – right alt key
  • ctrl_shift_toggle – ctrl+shift
  • alt_shift_toggle – alt+shift
  • ctrl_alt_toggle – ctrl+alt
  • caps_toggle – CapsLock
  • lctrl_toggle – left control key
  • switch – switch while the right alt is pressed
  • lwin_switch – switch while the left Windows key is pressed
  • rwin_switch – switch while the right Windows key is pressed
  • win_switch – switch while the any Windows key is pressed

No comments:

Post a Comment