Keyboard shortcuts don't work in different layouts
Basil Fowler
b.j.fowler at chanzy.eclipse.co.uk
Sun Jan 10 18:34:25 GMT 2010
On Sunday 10 Jan 2010 16:36:04 George wrote:
> On Sun, Jan 10, 2010 at 10:43 AM, Bogus Zaba <bogsub at bogzab.plus.com> wrote:
> > So now whenever I switch keyboard language, I re-run the above command
> > and regain my shortcuts.
>
> Since I frequently need to change keyboard layouts multiple times
> within the same sentence, doing this manually is not an option. Can I
> do it automatically, through a script or something like that?
Anything can be scripted, and scripted conveniently with kdialog. I have a
similar problem for my guest accounts. Sometimes they are run on the main
computer, sometimes on the X client computer (eccles). The former runs
Mandriva 2010.0, and the latter RedHat 7.1 (that distro works better on the
ancient but functional hardware of the X client).
My guests use various keyboard layouts. However, the keyboard layout files for
the Mandriva X server are different from the RedHat X server. So what I did
was to compile the keyboard driver files for the RedHat X server, transferred
them to the Mandriva computer and provided the following script that is called
by clicking on a desktop icon. A dialog box appears, and on selecting the
required language, the appropriate driver file is loaded according to which
machine the guest is using.
This does not cover your problem directly, but shows a possible approach.
Basil Fowler
-------------------------------------------------
Here beginneth the script (kept in the $HOME/bin directory):
#!/bin/bash
# selects and loads a keyboard layout
# put up a dialogue box and return action tokens
layout=$(kdialog --geometry=175x180 \
--caption "Keyboard" \
--menu "Select a layout" \
"1" "English" \
"2" "French" \
"3" "Hungarian" \
"4" "Portuguese" -- )
# establish which button was clicked
button_id=$?
if [ $button_id -eq 0 ]
then
if [[ ${DISPLAY} =~ ^eccles ]]
then
# use files suitable for RH 7
basedir="/usr/share/X11/xkb/eccles-xkb-files"
case $layout in
"1") xkbcomp "$basedir/eccles-gb.xkm" $DISPLAY ;;
"2") xkbcomp "$basedir/eccles-fr.xkm" $DISPLAY ;;
"3") xkbcomp "$basedir/eccles-hu.xkm" $DISPLAY ;;
"4") xkbcomp "$basedir/eccles-pt.xkm" $DISPLAY ;;
esac
else
# use 2010.0 files
fixedparms="-model pc105 -layout"
case $layout in
"1") setxkbmap $fixedparms gb ;;
"2") setxkbmap $fixedparms fr ;;
"3") setxkbmap $fixedparms hu ;;
"4") setxkbmap $fixedparms pt ;;
esac
fi
fi
# end
___________________________________________________
This message is from the kde mailing list.
Account management: https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.
More information about the kde
mailing list