Re: shortcuts using non-english keymap
- From: Danilo Segan <danilo gnome org>
- To: Pablo Saratxaga <srtxg chanae alphanet ch>
- Cc: gnome-i18n gnome org, pclouds <pclouds vnlinux org>
- Subject: Re: shortcuts using non-english keymap
- Date: Tue, 20 Apr 2004 18:59:13 +0200
Hi Pablo, "pclouds",
Today at 10:14, Pablo Saratxaga wrote:
> Kaixo!
>
> On Tue, Apr 20, 2004 at 09:32:41AM +0700, pclouds wrote:
>> Hi Danilo,
>>
>> I've never known this feature of Gtk+. I tried to avoid using
>> non-ascii characters as mnemonic keys. When i use "o+'" (U+1EDB LATIN
>> SMALL LETTER O WITH HORN AND ACUTE) as a mnemonic and press "o", it
>> doesn't work (ascii characters do). Can you tell me how to make it
>> work?
>
> You can't, unless that letter is available on a single key on a keyboard
> layout (it is the case with the "vi" keyboard layout, but it isn't
> used a lot).
>
> Being able to define alternate shortcuts, different of the one displayed
> (with the underlined letter) would be a nice feature, but
> AFAIK Gtk doesn't allow to do that.
Actually, you can, though not directly. If you've got recent XFree86,
you can do something like the following:
setxkbmap -layout ru,en_US # with "vi", it *might* be possible to
# use "vi,en_US" instead, but I don't know
Then, when you press eg. Ctrl/Alt + Cyrillic_O, Gtk+ will also treat
it as if you pressed Ctrl/Alt + O itself, and it will activate the
appropriate shortcut (if any).
If you're working on a solution for one particular language, you
might create such a map yourself, and do whatever you please.
For instance, try the following.
Put following lines into file /etc/X11/xkb/symbols/pc/gtktest
// cut here
default partial
xkb_symbols "basic" {
// this is ordinarily: q, Q
key <AD01> { [ a, A ] };
};
// cut here
Then, load it combined with Serbian keymap (before doing this, be sure
to be able to reset your keyboard map, because you'll be able to type
only Cyrillic after this command; I usually put something like
"setxkbmap en_US" in my bash history, and go to it with arrow keys and
Enter):
setxkbmap -layout sr,gtktest
Run gedit (you need to restart it if it's already running), and try
typing some text (you'll notice it's in Cyrillic, and pressing Q
should produce Љ or љ). Then, press Ctrl+Q, and you'll activate
Ctrl+A (all text would become selected/highlighted). So, you made
Gtk+ treat whatever keycode is produced by Q as a shortcut letter
A (Alt would also work; as an excercise, put "f, F" in there instead
of "a, A", and try activating File menu with Alt+Q).
In this way, you can create a "secondary" map for anything you
please, and you may insert them into the same file as the main map
(eg. either using "old" multiple groups per key definition, such as:
key <AD01> { [ Cyrillic_a, Cyrillic_A] , [ a, A ] };
or, preferably, using XFree86 4.3 and later "multilayout" features, by
putting it in separate xkb_symbols section "blah", and loading it with
setxkbmap like
setxkbmap -layout sr,sr -variant ",blah"
). Also note that if key is present in the first group Gtk+ comes
across, it won't look for it in later maps (at least it appears so to
me, I haven't checked this). So, if you combine two Latin-based
maps, you'll have to use keys from the first one loaded (eg. if you
use de,en_US, you could get Ctrl+Z only with the letter in top row,
not the bottom one).
So, this was sort of a quick and dirty guide. I hope you find it
useful.
Cheers,
Danilo
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]