More on keyboard layouts in Solaris 10 (on x86 platforms)
Regular readers will know by now, that I try to keep you guys happy - perhaps not quite to the level that the wonderful MaryMary does, but hey, I'm in engineering not marketing, and I just don't have the same contacts for obtaining free stuff as she does... (hmm, have to start working on that one)
David wrote a comment on a piece I posted a while back about Spanish Keyboards (astute readers will have noticed that post wasn't about keyboards at all, instead being a bit of a whinge on my part about fooling the most popular search engine in the world, but just to be nice, I ended it with a bit of free tech support about keyboard layouts in Solaris, which the aforementioned search engine seems to have latched on to - curse it! This post is only making things worse ! :-)). David was complaining about the complexity of setting up a Dvorak keyboard layout in Solaris. I agree with him 100% : it's not easy.
First, a confession - I don't use a Dvorak keyboard, not because I don't believe in the benefits that switching might bring, just that I can't spend a huge amount of time re-tuning my fingers to learn a new layout. People who've seen me type know that I have a somewhat erratic keyboarding style - I tend to go for the "high speed and very low accuracy" approach (my most typed key turns out to be BackSpace, I believe) The way I look at it, I'm having a whale of a time typing lots of letter sequences that don't get the attention they deserve in the English language, so I'm doing the world a good turn. (ahem). Not switching to the better techonology is sort of out of character for me : I always run the latest bleeding-edge Solaris builds I can get my hands on, I have no emotional attachment to any particular piece of software, particularly text editors or email clients, which tend to bring out the zealot in a lot of people (though it was borderline for me with the old OpenWindows mailtool, but I'm over that now, having used elm, pine, Dtmail, HotJava Views (which I loved), Mozilla, Thunderbird, Mac OSX Mail.app, Mulberry and Evolution along the way... Evo seems to be the one I've settled on for the moment)
So software, yes - I'm there, but keyboards, nope - still in the dark ages I'm afraid. The nearest I ever get to switching keyboard layouts these days is when I have to use a US keyboard that might be attached to a Sun Ray in some meeting room or other, and that's a real pain. In those cases, xmodmap comes to the rescue, and I use the following to bring some sanity :
#!/bin/sh cat > /tmp/tim.xmodmap <<EOF caps_lock="Control_L" control="Control_L" control_l="Caps_Lock" EOF xmodmap < tmp/tim.xmodmap echo Swapped Caps Lock and \(left\) control key echo made the key to the left of F1 work as Escape rm /tmp/tim.xmodmap
Seriously, what were those Americans thinking, putting the caps-lock where control should be ? It was different back in my Solaris Localisation Testing days (wow, was that really 10 years ago !?) I'd come across new keyboard layouts all the time back then. Testing keyboard layouts was one of the things we did in the European Localisation Centre, where keyboard-types were rotated along with the usual test-cycle of installing and running Solaris in different locales. I remember that some layouts seemed to be going out of their way to make life difficult for the UNIX user (I mean, putting the '/' character on the "Shift-7" position ? Xmodmap came to the rescue there, whenever we needed to do stuff on the command line)
Thing is though, I'm not sure xmodmap is a good thing to use to switch entire keyboard layouts : remapping the odd key here and there is fair enough, but changing all of them ? Ouch. Jamie Zawinski agrees with me it seems, he says :
Although this may seem like a simple issue it is in fact one of the most complicated/convoluted things about X Windows - "If you're thinking that this is all senselessly complicated... you're` right" - Jamie Zawinski, author of xkeycaps. (quote source)
So, xmodmap isn't making things very much easier. I'm not sure things have got a whole lot better since, to be honest. I freely admit to not completely understanding the new Xorg keyboard layout stuff but I'm starting to dabble. However, getting back to the point (there is one in here somewhere, struggling to get out) - here's how to swap the keyboard layout in Solaris 10.
For some reason, we're not shipping a utility that comes with the
standard Xorg distribution called setxkbmap.
Inside the GNOME Keyboard Indicator, which you get by right-clicking on
the GNOME Panel, select "Add to panel", "Utility
-> Keyboard Indicator", there's options for changing the
keyboard layout. Right click on this panel application, select
"Preferences" and you'll see this :
This shows the list of keyboards I'm interested in : you'll notice that
each layout I have added to the list has "xkb keymap"
at the end of it. It seems that the keyboard indicator applet tries to
use setxkbmap to switch layouts if you've selected an xkb
keymap, and uses xmodmap otherwise. Of course, since we don't bundle
setxkbmap (yet?) we get the weird error dialog :
This is another example of a dialog box that doesn't really help : I've complained about these sort of things before, guess it's time to file another bug...
If you have setxkbmap, just drop it somewhere in your $PATH, and
everything should be alright - the layout switcher will use it if you
select an xkb layout. I've compiled a binary
of setxkbmap on my laptop, so you're welcome to use it if you like.
Anyway, this post was just to point out, that you can change keyboard
layouts pretty easily in Solaris now with JDS/GNOME, assuming you've got setxkbmap
and use the keyboard layout switcher. Messing around with xorg.conf
will work as well, though that's changing the layout for all users of
your machine, which may or may not be what you intended. Hope this helps
?
timf@argentum[504] digest -a md5 bin/setxkbmap
79885096b983c509ab8a896e9c520278
By the way, if you've updates or corrections on any of the above,
I'd love to hear about it : just add them to the comments, and I'll fix
anything I've got wrong in the main body of the post.
In GNOME 2.10, the distinction is more clear; the applet will complain if the X server specifies a layout and will let you choose to do either the X server or the GNOME way. I think that in older versions of GNOME, you could also configure the layout using setxkbmap and xmodmap, which confuses a bit...
I would highly recommend you to try out an Ubuntu LiveCD since it comes with GNOME 2.10, to figure out the exact behaviour. You can get it at http://www.opensourcemirrors.org/linux/ubuntu-cd/5.04/
There are limitations in XIM and GTK+ IM, which are addressed collectively with some exotic input methods, such as IIIMF and SCIM.
For some background reading, have a look at Chapter 9, at http://anakin.ncst.ernet.in/~aparna/consolidated/
Redhat supports IIIMF, as it is good for many Asian languages. I suppose to test the latest version, you would need to install a Fedora Core 4 test. See: http://fedora.redhat.com/projects/i18n/iiimf-faq.html You can install manually iiimf on Ubuntu/Debian, by adding the Universe repository (though it's not the latest package).
For a bit more about IIIMF and how "good" it is, check out the last two entries of the blog http://www.livejournal.com/users/llch/
Posted by Simos on April 25, 2005 at 05:40 PM IST #
Solaris uses IIIMF alright (hi Hideki! :-) for languages that require it (eg. in our UTF-8 locales, we have a Compose file (part of XIM, I believe) that allows us to choose which input method engine to apply : either "simple" ones (Compose-c-, == ç) or the more complex language-engine based ones... There's about 14 different ones in the menu at the moment :
- English/European
- Cyrillic
- Greek
- Arabic
- Hebrew
- Unicode Hex
- Unicode Octal
- Lookup (allows you to choose from unicode planes)
- Japanese
- T-Chinese (Hong Kong)
- S-Chinese
- T-Chinese
- Indic
- Korean
- Thai
- there may be others in specific locales, these are just those available in the UTF-8 ones..I don't know much about (hadn't heard of) GTK+ IM, but I'll look into it. I was under the impression that the gnome keyboard applet was just using setxkbmap or xmodmap as appropriate : according to DTrace, that's all it's doing here anyway...
Here's me tracing all exec calls in the keyboard layout switcher while swapping between layouts :
24749 1334 749 sh -c setxkbmap us 24749 1335 1334 setxkbmap us 0 1336 273 sh -c /usr/X11/lib/X11/xkb/xkbcomp -w 1 -R/usr/X11/lib/X11/xkb -xkm - -em1 "The 0 1337 1336 /usr/X11/lib/X11/xkb/xkbcomp -w 1 -R/usr/X11/lib/X11/xkb -xkm - -em1 The XKEYBO 24749 1338 749 sh -c setxkbmap it 24749 1339 1338 setxkbmap it 0 1340 273 sh -c /usr/X11/lib/X11/xkb/xkbcomp -w 1 -R/usr/X11/lib/X11/xkb -xkm - -em1 "The 0 1341 1340 /usr/X11/lib/X11/xkb/xkbcomp -w 1 -R/usr/X11/lib/X11/xkb -xkm - -em1 The XKEYBO 24749 1342 749 sh -c setxkbmap dvorak 24749 1343 1342 setxkbmap dvorak 0 1344 273 sh -c /usr/X11/lib/X11/xkb/xkbcomp -w 1 -R/usr/X11/lib/X11/xkb -xkm - -em1 "The 0 1345 1344 /usr/X11/lib/X11/xkb/xkbcomp -w 1 -R/usr/X11/lib/X11/xkb -xkm - -em1 The XKEYBO 24749 1346 749 sh -c gkb_xmmap gb-102 24749 1348 1347 xmodmap /usr/share/xmodmap/xmodmap.gb-102but I do hear what you're saying about moving away from x-managed input method stuff with all the keyboard-craziness that comes with it : hopefully using IIIMF more will get away from all that.Posted by Tim Foster on April 25, 2005 at 06:01 PM IST #
Thank you for the info, but...
I cannot find the
"Utility -> Keyboard Indicator" when I use "Add to panel" in my GNOME Panel.
The GNOME Panel version is 2.16.1,
OS is 5.11 snv_62 i86pc
Posted by Leon Koll on December 25, 2007 at 08:57 AM GMT #
Hi Leon, sorry I don't have nv_62 here to check, but here's how it appears to work in nv_79, running in a UTF-8 locale. The settings have moved to the "Preferences->Input method" screen.
You now need to add keyboard support by selecting keyboard layouts from the "Available Languages/Scripts" pane, clicking "Add" to add them into the "Languages/Scripts to input". (each keyboard layout has a little keyboard icon beside it)
Then, the input method notification area on the GNOME panel will show which keyboard layout you're using - clicking on the notification area allows you to switch between layouts you've added. You can also assign a hotkey to cycle between layouts as well, if this is more convenient.
Hope this helps ?
Posted by Tim Foster on January 04, 2008 at 02:33 PM GMT #
Thank you.
In nv_77 the "Available Languages/Scripts" pane is empty.
Posted by Leon Koll on January 06, 2008 at 03:51 PM GMT #
Foster, changing keyboard in Solaris does not works well. Everybody knows that. On my table lays Type 7 with Russian layout and no idea how make posssible to change layouts between English and Lithuanian (although Russian). That stuff with keyboard indicator works, but crashes system more early and later.
Posted by Andrius Burlega on September 17, 2008 at 11:49 PM IST #
Can you provide hints on how to compile setxkbmap on Solaris 10? I've looked at that, but it doesn't look easy - there are multiple versions of setxkbmap, and the versions I've tried did not compile. Which exactly source code did you use?
Posted by Maciej Bliziński on July 24, 2009 at 10:20 AM IST #
I honestly can't remember Maciej - I wrote this post 4 years ago and have forgotten the details of what I did. It might be worth raising a case under your support contract in order to get them to figure it out?
Posted by Tim Foster on July 24, 2009 at 10:34 AM IST #
Tim I am trying to send Sun Keybaord PrintScreen to Citrix via a Solaris ICA Client
Can I use xmodmap to do this? If so how do I do it
Posted by michael johnson on October 14, 2009 at 01:04 PM IST #