Subject: FVWM: window-local keymap

From: KONTRA Gergely <[email-masked]>
Date: Tue, 23 Sep 2003 16:54:58 +0200

Hope it is not in the FAQ:

I want to set up fvwm to be able to switch languages in windows
independent.
(perhaps it should be in the faq :) What do you think?)

I guess the answer will be FvwmEvent again, if no smarter solution
exists...

Gergo
-- 
+-[ Kontra, Gergely<[email-masked]> PhD student Room IB113 ]---------+
| http://www.mcl.hu/~kgergely            "Olyan langesz vagyok, hogy  |
| Mobil:(+36 20) 356 9656 ICQ: 175564914   poroltoval kellene jarnom" |
+-- Magyar php mirror es magyar php dokumentacio: http://hu.php.net --+
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: [email-masked]
Date: Sun, 28 Sep 2003 08:28:47 +0200

> I want to set up fvwm to be able to switch languages in windows

What does that mean?  What does fvwm have to do with it?

> I guess the answer will be FvwmEvent again, if no smarter solution

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, [email-masked]
Reply-To: [email-masked]
--
Visit the official FVWM web page at <URL: http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: KONTRA Gergely <[email-masked]>
Date: Mon, 29 Sep 2003 09:38:06 +0200

> What does that mean?  What does fvwm have to do with it?

Summary: fvwm must respond to focus changes and store information about
window-keymap relationships.

When I change keymap, while focus in a window, fvwm should remember the
keymap associated to that window.
When I leave the window, fvwm should restore the keymap what was before.
When I return to that window, fvwm should change to the remembered
keymap.

So: If I fire up several xterms, (keymap was english before), every
xterm should will work with english keymap.

Then, I start to write a Hungarian letter in an xterm, so I press
_whatever_key_ to change the keymap to hu. Then, I switch to another
xterm, and start to write a German letter (and switch the keyboard with
the keyboard before, of course)...

Now, when I switch back to my Hungarian letter, I can continue typing,
because fvwm changed my keyboard to Hungarian.
Then I switch to the German letter, and continue my German letter. Then,
I fire up a new xterm, and start typing... and expect an english keymap
(which is ideal for shells, programming...)

Gergo

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 29 Sep 2003 09:59:12 +0200

> When I return to that window, fvwm should change to the remembered

Understood.  What I do not understand is why the keymap should be
associated with windows.  At least on my keyboard, the labels on
the keys are not going to change when the focus is moved.

> (which is ideal for shells, programming...)

Hm.  Well, keymap management is not really in the scope of the
window manager, but with FvwmEvent you can solve this, however
inefficient that solution may be.  In the future, FvwmEvent may
move into the fvwm core, which should greatly improve its
performance.  I see no need to write a specific command to manage
keymaps.

Ciao

Dominik ^_^  ^_^

---

From: KONTRA Gergely <[email-masked]>
Date: Mon, 29 Sep 2003 11:03:35 +0200

> performance.  I see no need to write a specific command to manage

Ok, I understand. I will use FvwmEvent, I just hoped sy. uses it that
way, or I can get a pointer to a good example...

I'll hack something and see, if it works...

Gergo

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 29 Sep 2003 11:09:02 +0200

> I'll hack something and see, if it works...

If you get it working, could you write something for the FAQ?

Ciao

Dominik ^_^  ^_^

---

From: KONTRA Gergely <[email-masked]>
Date: Mon, 29 Sep 2003 12:05:21 +0200

> If you get it working, could you write something for the FAQ?

Ok, I'll try, but first I should carefully read the F...ine manual.

Gergo

---

From: Glyn Millington <[email-masked]>
Date: Mon, 29 Sep 2003 10:16:41 +0100

> window-keymap relationships.

I've no idea how to set this up but if you work it out PLEASE post it to
the list (or to me!!) - it would be really useful ;-)

Peace

Glyn

---

From: KONTRA Gergely <[email-masked]>
Date: Mon, 29 Sep 2003 17:12:04 +0200

On 0923, KONTRA Gergely wrote:

Hi!

To complete the window-local keymap, I need the following:

I can set an environment variable to store the current keymap with

SetEnv $[w.id]-key

But how can I read it back? So, if I
SetEnv Keymap-$[w.id] hu

Then, how do I set the keyboard to Keymap-$[w.id] ?
Exec setxkbmap ????

???? - the value of the environment variable, which is Keymap-$[w.id]

Gergo

---

From: Dominik Vogt <[email-masked]>
Date: Mon, 29 Sep 2003 17:40:41 +0200

> I can set an environment variable to store the current keymap with

You should better not use a hyphen in the name and begin it with
a letter, e.g.

  SetEnv keymap$[w.id] ...

> But how can I read it back? So, if I

It's surprisingly difficult to do nested expansions.  This works:

  piperead "echo setenv tmp_keymap $$\\[keymap$[w.id]\\]"

Now you have the 

(Note: both functions must be called in a valid window context).

> Then, how do I set the keyboard to Keymap-$[w.id] ?

  Exec setxkbmap "$[tmp_keymap]"

Ciao

Dominik ^_^  ^_^

---

From: KONTRA Gergely <[email-masked]>
Date: Mon, 29 Sep 2003 18:08:38 +0200

So, here is my solution.
Shortcomings:
- different keys for different languages
- no "default" keyboard, if the window doesn't have own keymap.
  If you fire up fvwm, and an xterm, change the keymap in the xterm, and
  after that fire up a new xterm, then the keymap won't change back.

*FvwmEvent-LocalKeymap: focus_change RestoreKeymap
Module FvwmEvent FvwmEvent-LocalKeymap

DestroyFunc RestoreKeymap
AddToFunc RestoreKeymap
+ I Piperead "echo SetEnv tmp_keymap $$\\[keymap_$[w.id]\\]"
+ I Echo "Autoswitch to $[tmp_keymap] keyboard layout"
+ I Exec setxkbmap $[tmp_keymap]

DestroyFunc HuKeyboard
AddToFunc HuKeyboard
+ I SetEnv keymap_$[w.id] hu
+ I Exec setxkbmap hu
+ I Echo "Switch to Hungarian keyboard"

AddToFunc UsKeyboard
+ I SetEnv keymap_$[w.id] us
+ I Exec setxkbmap us

Key Shift_L W M HuKeyboard
Key Shift_R W M UsKeyboard

---

From: Mikhael Goikhman <[email-masked]>
Date: Tue, 30 Sep 2003 00:08:44 +0300

> I guess the answer will be FvwmEvent again, if no smarter solution

You may search for "FvwmKb" in Google to see at least one solution.

Regards,
Mikhael.

---

From: Michelle Konzack <[email-masked]>
Date: Mon, 29 Sep 2003 12:04:09 +0200

>the keys are not going to change when the focus is moved.

Hello Dominik, 

I have the same problem, because I am using a franco-arabe 
Keyboard which have the french and araic Letters. 

I do development for Turkia, Iran/Afghanistan, Iraq and Syria. 
So I have some Problems which can not handled by the OS, but 
maybe by the WindowManager.

>performance.  I see no need to write a specific command to manage

Are you sure ?
And if I ask you very nice ?
;-)

>Dominik ^_^  ^_^

Greetings from Strasbourg
Michelle

-- 
Registered Linux-User #280138 with the Linux Counter, http://counter.li.org.