Subject: FVWM: MoveToPage and tabular menu

From: Phil Stracchino <[email-masked]>
Date: Tue, 11 May 2004 16:26:39 -0400

I use a 4x4 Pager, giving me 16 screens.  I have a "Send to Page..."
item on my WindowOps menu that opens a popup listing the 16 paaible
pages, the entries on which perform a MoveToPage x y.

naturally, the popup is displayed as:

 | ...              |
 | (De)Iconify      |
 | (Un)Stick)       |
 | (un)Maximize     |
 | ---------------- |____
 | Send to Page... >| 1  |
 | Delete           | 2  |
 | Close            | 3  |
 | Destroy          | 4  |
 | ...              | ...|

What I'd LIKE it to do is this:

 | ...              |
 | (De)Iconify      |
 | (Un)Stick)       |
 | (un)Maximize     |
 | ---------------- |_____________
 | Send to Page... >| 1  2  3  4  |
 | Delete           | 5  6  7  8  |
 | Close            | 9  10 11 12 |
 | Destroy          | 13 14 15 16 |
 | ...              |-------------

Can anyone suggest a way to accomplish this?  I'm assuming I'll have to
use something like a transient button banel.

-- 
 .*********  Fight Back!  It may not be just YOUR life at risk.  *********.
 : phil stracchino : unix ronin : renaissance man : mystic zen biker geek :
 :  [email-masked][email-masked][email-masked]  :
 :   2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)   :
 :    Linux Now!   ...Because friends don't let friends use Microsoft.    :
--
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: Mikhael Goikhman <[email-masked]>
Date: Wed, 12 May 2004 03:05:46 +0000

> What I'd LIKE it to do is this:

You can't open any new window while browsing menus.

So, you may wait for the native tabular menus implementation if any...

Or you may have a menu entry that is Module, not Popup, to open transient
FvwmButtons instead of the menu (unlike the diagram above).

Or, if you are a programmer, you may add a new command line option to the
transient FvwmPager to execute MoveToPage instead of GotoPage on click.

Regards,
Mikhael.

---

From: Phil Stracchino <[email-masked]>
Date: Tue, 11 May 2004 23:28:11 -0400

> So, you may wait for the native tabular menus implementation if any...
...
> transient FvwmPager to execute MoveToPage instead of GotoPage on click.

Hmmm.  That would be an elegant solution, wouldn't it?

---

From: Nicholas Paul Johnson <[email-masked]>
Date: Wed, 12 May 2004 02:14:19 -0400 (EDT)

I've tried the transient fvwm buttons solution, here is what I've found:

Because the button is pushed from within the context of GridButtons, 
the MoveToDesk (and presumably similar commands) still require the user 
select a window.

Also, the buttons start at +0+0, which I do not know how to fix :(

Either way, here is an example .fvwm2rc.  If anyone can get it to work 
better, I too would like to see it :)

# I use 8 instead of 16 desks... you may want to change it...
DestroyModuleConfig GridButtons
*GridButtons: geometry 128x64
*GridButtons: columns 4
*GridButtons: rows 2
*GridButtons: (Title "0", Action (Mouse 1) "MoveToDesk 0 0")
*GridButtons: (Title "1", Action (Mouse 1) "MoveToDesk 0 1")
*GridButtons: (Title "2", Action (Mouse 1) "MoveToDesk 0 2")
*GridButtons: (Title "3", Action (Mouse 1) "MoveToDesk 0 3")
*GridButtons: (Title "4", Action (Mouse 1) "MoveToDesk 0 4")
*GridButtons: (Title "5", Action (Mouse 1) "MoveToDesk 0 5")
*GridButtons: (Title "6", Action (Mouse 1) "MoveToDesk 0 6")
*GridButtons: (Title "7", Action (Mouse 1) "MoveToDesk 0 7")

AddToMenu Window-Ops2   "&move"         Move
+                       "to &page"      Module FvwmButtons -transient \ 
GridButtons
+                       "&resize"       Resize
+                       "r&aise"        Raise
+                       "&lower"        Lower
+                       ""              Nop
+                       "identi&fy"     Module FvwmIdent
+                       ""              Nop
+                       "(Un)s&hade"    WindowShade
+                       "(Un)&stick"    Stick
+                       "(Un)ma&ximize" Maximize
+                       ""              Nop
+                       "&close"        close

"I've got the I-gotta-work-at-9-am-(7-hours-from-now-edt)-blues..."
- -- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  Nicholas Paul Johnson
  o nickjohnson \at\ virginia \dot\ edu
  o 3ebf10a7 subkeys.pgp.net
  o http://manjac.ath.cx/nick
  o "When all you've got is a hammer,
    everything looks like a nail.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

---

From: Xavier Maillard <[email-masked]>
Date: Wed, 12 May 2004 12:10:39 +0200

On 12 May 2004, Nicholas Paul Johnson wrote:

> the  MoveToDesk (and  presumably similar  commands) still  require the
> user select a window.
> 

Bah, you just have to tell it to be at your cursor position, no ?

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

---

From: Mikhael Goikhman <[email-masked]>
Date: Wed, 12 May 2004 11:47:59 +0000

> the MoveToDesk (and presumably similar commands) still require the user 

Yes... I think transient FvwmButtons should preserve the original window
context. But you may workaround this, like:

  AddToMenu Window-Ops2
  + "Move to Page" SelectPageToMoveWindow

  AddToFunc SelectPageToMoveWindow
  + I SetEnv LAST_WIN_ID $[w.id]
  + I FvwmButtons -g 128x64+$[pointer.x]+$[pointer.y] -transient GridButtons

  AddToFunc MoveLastWindowToDesk
  + I WindowId $[LAST_WIN_ID] MoveToDesk 0 $0

  *GridButtons: (Title "0", Action "MoveLastWindowToDesk 0")
  [...]
  *GridButtons: (Title "7", Action "MoveLastWindowToDesk 7")

Not tested, but if the code you posted works for you, then this one
should work too.

> Also, the buttons start at +0+0, which I do not know how to fix :(

Using -g command line option, see the code above. You may also make it
centered under cursor, just calculate appropriate coordinates.

Regards,
Mikhael.

---

From: Phil Stracchino <[email-masked]>
Date: Wed, 12 May 2004 08:25:48 -0400

> Not tested, but if the code you posted works for you, then this one

This works fairly nicely for me, like so:

AddToFunc SendWindowToPage
+	I	SetEnv LAST_WIN_ID $[w.id]
+	I	FvwmButtons -g 144x96+$[pointer.x]+$[pointer.y] -transient GridButtons

AddToFunc MoveLastWindowToPage
+	I	WindowId $[LAST_WIN_ID] MoveToPage $0 $1

DestroyModuleConfig GridButtons
*GridButtons: columns 4
*GridButtons: rows 4
*GridButtons: (Title "0",  Action "MoveLastWindowToPage 0 0")
*GridButtons: (Title "1",  Action "MoveLastWindowToPage 1 0")
...
*GridButtons: (Title "15", Action "MoveLastWindowToPage 3 3")

except that FvwmButtons is not honoring the -g specification
144x96+$[pointer.x]+$[pointer.y].  Size alone is honored, size+position
is honored if the position is a fixed specification, but the
pointer-position specification does not work.  What is the first fvwm2
version in which the $[pointer.x] notation should be valid? I'm running
2.4.16 at present.

---

From: Mikhael Goikhman <[email-masked]>
Date: Wed, 12 May 2004 12:36:55 +0000

> version in which the $[pointer.x] notation should be valid? I'm running

2.5.1, you may read NEWS file on the web to get such info.

Actually, it may look nicer (or not) if such transient window is just
centered on the screen.

BTW, to be really accurate, it should be escaped in some cases, i.e.
$$[pointer.x], to avoid too early expansion.

Regards,
Mikhael.

---

From: Phil Stracchino <[email-masked]>
Date: Wed, 12 May 2004 08:43:24 -0400

> 2.5.1, you may read NEWS file on the web to get such info.

OK, looks like I now have a reason to move to 2.5.

---

From: Phil Stracchino <[email-masked]>
Date: Wed, 12 May 2004 19:59:49 -0400

> 2.5.1, you may read NEWS file on the web to get such info.

I have just downloaded and installed 2.5.10, and it's now working.  I
have a visually-reasonabl;e static offset set up as follows:

DestroyFunc SendWindowToPage
AddToFunc SendWindowToPage
+		I	SetEnv LAST_WIN_ID $[w.id]
+		I	. FvwmButtons -g 144x96+%{ $[pointer.x]-34
}%+%{ $[pointer.y]-24 }% -transient GridButtons

However, I'd LIKE to be able to make the button panel position itself
such that the pointer is on the button corresponding to the current
page.  To do that, however, I need to retrieve the current page.  I know
I can retrieve the current *desk* thropugh the variable desk.n, so I
guessed page.n but found my guess was wrong.

Is there such a variable, and if so, what is it?  Where can I find
documentation of all the available variables?

---

From: Phil Stracchino <[email-masked]>
Date: Wed, 12 May 2004 20:17:11 -0400

> documentation of all the available variables?

Never mind, after forcibly dumping outdated manpages, I found it.

---

From: Mikhael Goikhman <[email-masked]>
Date: Thu, 13 May 2004 00:22:32 +0000

On 12 May 2004 19:59:49 -0400, Phil Stracchino wrote:
> + I . FvwmButtons -g 144x96+%{ $[pointer.x]-34 }%+%{ $[pointer.y]-24 }% -transient GridButtons

So, you got at least FvwmPerl too by switching to 2.5.x.

> guessed page.n but found my guess was wrong.

You almost got it right, but pages span 2 directions, thus $[page.nx] and
$[page.ny].

> documentation of all the available variables?

In the man page. You may easily consider any feature not found in the man
pages unexisting.

Regards,
Mikhael.

---

From: Phil Stracchino <[email-masked]>
Date: Wed, 12 May 2004 22:39:00 -0400

> In the man page. You may easily consider any feature not found in the man

And that is indeed where I found it, once I first found the outdated
manpage that was getting picked up ahead of it and removed it.

Incidentally, you get some really odd visual effects if you start
fvwm-2.5.10 with the ModulePath still pointing to fvwm-2.4.16....
(color me sheepish)

---

From: Phil Stracchino <[email-masked]>
Date: Wed, 12 May 2004 23:48:59 -0400

> fvwm-2.5.10 with the ModulePath still pointing to fvwm-2.4.16....

Oh, at any rate, here's my final code, for anyone else's reference who
might care to use it:

DestroyFunc .
AddToFunc .
+ I SendToModule FvwmPerl preprocess -c -- $*

DestroyFunc SendWindowToPage
AddToFunc SendWindowToPage
+ I SetEnv LAST_WIN_ID $[w.id]
+ I . FvwmButtons -g 144x96+%{$[pointer.x]-$[page.nx]*36-34}%+%{$[pointer.y]-$[page.ny]*24-20}% -transient GridButtons

DestroyFunc MoveLastWindowToPage
AddToFunc MoveLastWindowToPage
+ I WindowId $[LAST_WIN_ID] MoveToPage $0 $1

DestroyModuleConfig GridButtons
#*GridButtons: geometry 144x96
*GridButtons: columns 4
*GridButtons: rows 4
*GridButtons: (Title "0",  Action "MoveLastWindowToPage 0 0")
*GridButtons: (Title "1",  Action "MoveLastWindowToPage 1 0")
*GridButtons: (Title "2",  Action "MoveLastWindowToPage 2 0")
*GridButtons: (Title "3",  Action "MoveLastWindowToPage 3 0")
*GridButtons: (Title "4",  Action "MoveLastWindowToPage 0 1")
....
*GridButtons: (Title "15", Action "MoveLastWindowToPage 3 3")

This creates a 4x4 button panel, essentially the same size as my pager,
which pops up under the mouse pointer with the button representing the
current page under the pointer, thus making all the adjacent pages the
shortest mouse movement away.

---

From: Ukpong Ukpong <[email-masked]>
Date: Thu, 13 May 2004 20:10:45 +0100 (BST)

Just wondering how do you invoke it, been tryiing to figure it but getting 
not where !!

---

From: Phil Stracchino <[email-masked]>
Date: Thu, 13 May 2004 17:14:00 -0400

> Just wondering how do you invoke it, been tryiing to figure it but getting 

Oh, sorry.

I invoke it from my WindowOps menu at present:

AddToMenu Window-Ops	"Window Ops"		Title		
...
+			"(Un)Maximize"		Maximize
+			""			Nop
+			"Send to &Page..."	SendWindowTopage
+			"Delete"		Delete
...

I'm thinking of also assigning it to button 8, but haven't designed a
suitable vector button yet.  (Though I have ideas.)