Subject: FVWM: this morning's fvwmrc hack - menus matching key ops

From: Cameron Simpson <[email-masked]>
Date: Sat, 10 Aug 2002 11:40:39 +1000

Perhaps I have a poor attention span, but I've long had a problem with
keeping my key mappings and functions-present-in-menus in sync; I would
generally like to be able to do most things with a keystroke, and would
still like every such action available in a menu if brain fade prevents
me remembering the magic keystoke.

Thus today's exercise. Two functions, KeyFn and MouseFn to set a key or
mouse mapping and also record it in a menu:

	# KeyFn menu desc keyname context mods "cmd-and-args"
	DestroyFunc KeyFn
	AddToFunc KeyFn         "I"             Key $2 $3 $4 $5
	+                       "I"             AddToMenu $0 "$1" $5

	# MouseFn menu desc button context mods "cmd-and-args"
	DestroyFunc MouseFn
	AddToFunc MouseFn       "I"             Mouse $2 $3 $4 $5
	+                       "I"             AddToMenu $0 "$1" $5

Now my menu definitions are a bit wordier, but nothing will
slip through the cracks:

	DestroyMenu WinOps
	AddToMenu WinOps        "Window Ops"    Title
	KeyFn WinOps "Desk Windows"             L A M           "WindowList (CurrentDesk) Alphabetic SelectOnRelease
	[...]
	KeyFn WinOps "Raise"                    H W CS          "Raise"
	KeyFn WinOps "Lower"                    H W CS          "Lower"
	MouseFn WinOps "Resize"                 1 W M           "Resize"
	MouseFn WinOps "Move"                   2 W M           "Move"
	Mouse                                   3 W M           Move
	[...]

Remark on that last: I often have mouse 3 do what mouse 2 does because I
switch keyboards a lot. So one incantation for M2 to put it in the menu,
and a conventional binding for M3 to match.

Cheers,
-- 
Cameron Simpson, DoD#743        [email-masked]    http://www.zip.com.au/~cs/

The wages of sin are death, but the benefits include dental, major medical,
two week paid vacation, pension fund, and stock options.  Actually, taken as
a package, it's a rather attractive deal.
	- Tim Mefford, [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: Dominik Vogt <[email-masked]>
Date: Sat, 10 Aug 2002 23:41:55 +0200

> 	+                       "I"             AddToMenu $0 "$1" $5

Nice idea.  Here's an enhancement that displays the key binding
in the right column of the menu:

  + "I" AddToMenu $0 "$1<Tab>($4-$2)" $5

Replace <Tab> with a real tab.

> and a conventional binding for M3 to match.

Bye

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: Cameron Simpson <[email-masked]>
Date: Mon, 12 Aug 2002 16:04:25 +1000

On 23:41 10 Aug 2002, Dominik Vogt <[email-masked]> wrote:
| > Thus today's exercise. Two functions, KeyFn and MouseFn to set a key or
| > mouse mapping and also record it in a menu:
| > 
| > 	# KeyFn menu desc keyname context mods "cmd-and-args"
| > 	DestroyFunc KeyFn
| > 	AddToFunc KeyFn         "I"             Key $2 $3 $4 $5
| > 	+                       "I"             AddToMenu $0 "$1" $5
| > 
| > 	# MouseFn menu desc button context mods "cmd-and-args"
| > 	DestroyFunc MouseFn
| > 	AddToFunc MouseFn       "I"             Mouse $2 $3 $4 $5
| > 	+                       "I"             AddToMenu $0 "$1" $5
| 
| Nice idea.  Here's an enhancement that displays the key binding
| in the right column of the menu:
| 
|   + "I" AddToMenu $0 "$1<Tab>($4-$2)" $5
| 
| Replace <Tab> with a real tab.

Heh. I was trying to find the right syntax for _exactly_ that
change. Applied. Thanks!
-- 
Cameron Simpson, DoD#743        [email-masked]    http://www.zip.com.au/~cs/

Here's a great .sig I wrote, so good it doesn't rhyme.
	Jon Benger <[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].