Friday, April 22, 2011

Haiku keyboard layouts

All of the other OSes that I use have a panel icon for one-click changing of keyboard layouts (I type in both English and Brazilian Portuguese).
However, this is not available in Haiku.
Instead you need to go to Deskbar Leaf > Preferences > Keymap and then, in the left hand listing of available layouts, choose the one you want.
To make this change less cumbersome I created small scripts which I placed in the LaunchBox (which I use as a dock on the bottom of the screen).
First, open the Keymap as above in one of the layouts you want. Then, in the Keymap, File > Save as an appropriate name. I used us=English and pt=Portuguese.
Now, two new files will appear in /boot/home/config/settings/Keymap/
Next create scripts to open these files.
The scripts are of the form

#! /bin/bash
keymap -l /boot/home/config/settings/Keymap/us

Save the file (I saved to my ~) with a suitable name (I used kbd_us and kbd_pt). Then make it executable in the terminal with
chmod a+x kbd_us

Now just place these executables in LaunchBox from where they can be used to switch from one layout to the other with just one click.
If you want a special icon in LaunchBox, right-click on the executable file inthe home directory (or wherever you put it) and click add-ons > fiel type.
Now just drag a suitable icon to the icon section of the window that opens.
In my own case, I just couldn't find national flags in the HVIF format that Haiku needs so I had to settle temporarily with some that I found in here.

No comments:

Post a Comment