Subject: Re: FVWM: form to rename desktop

From: Victor Eijkhout <[email-masked]>
Date: Thu, 14 Mar 2002 23:27:58 -0500

>  > This doesn't work:
>>
>>  AddToFunc NameThisDesk
>>  + "I" KillModule FvwmForm
>>  + "I" Module FvwmForm NameDesk
>>  DestroyModuleConfig NameDesk: *
>>  *NameDesk: Line left
>>  *NameDesk: Text "Name this desktop:"
>>  *NameDesk: Line expand
>>  *NameDesk: Input deskname 20 ""
>>  *NameDesk: Button quit "OK" ^M
>>  *NameDesk: Command *FvwmPager: Label * $(deskname)
>>
>>  probably because FvwmPager: Label is a configuration, not a command.
>>
>>  What's a better way to do it?
>
>You might try to restart the Pager
>Command KillModule FvwmPager
>Command Module FvwmPager

So I tried

*NameDesk: Button quit "OK" ^M
*NameDesk: Command *FvwmPager: Label * $(deskname)
*NameDesk: Command KillModule FvwmPager
*NameDesk: Command Module FvwmPager

I did that while on Desk #4. It renamed Desk #1 and emptied the pager 
of all other desks.

Rereading the resource file as part of the commands makes no difference.
-- 
Victor Eijkhout <[email-masked]>
tel: 865 974 9308 (W), 865 673 6998 (H), 865 974 8296 (F)
http://www.cs.utk.edu/~eijkhout/
--
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: Dan Espen <[email-masked]>
Date: Fri, 15 Mar 2002 08:53:17 -0500

> I did that while on Desk #4. It renamed Desk #1 and emptied the pager 

Those module commands, (the commands starting with "*"), add
up.  Ie. FVWM saves all of them and then sends them to the module
when it starts.

What you  might want to do  is add a "DestroyModuleConfig" followed by
all the module commands for the Pager each time you restart the pager.

-- 
Dan Espen                           E-mail: [email-masked]
444 Hoes Lane  Room RRC 1C-214      Phone: (732) 699-5570
Piscataway, NJ 08854
--
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: Victor Eijkhout <[email-masked]>
Date: Fri, 15 Mar 2002 10:20:23 -0500

>all the module commands for the Pager each time you restart the pager.

I tried something like that. Having all the pager configuration in a 
file, and sourcing it.

The problem remains the renaming: I can write "Label * <new name>" at 
the end of that file, but that "*" does not expand to a real number.

I'm starting to conclude that what I want is not possible with fvwm. 
(Let's hope them's fightin' words to some around here :-)

---

From: Marcus Lundblad <[email-masked]>
Date: Fri, 15 Mar 2002 16:30:44 +0100 (CET)

> (Let's hope them's fightin' words to some around here :-)

What you can do is to have files that contain the desktop names, like:
.fvwm/desk0 .fvwm/desk1 for example
and let the script echo the name to the correct file (using FvwmCommand I
think..)

And then write a function that creates the module configuartion and
(re)starts a pager.

This also makes the name "stick" through logins.

I believe this is possible

//Marcus

---

From: Victor Eijkhout <[email-masked]>
Date: Fri, 15 Mar 2002 11:36:24 -0500

>and let the script echo the name to the correct file (using FvwmCommand I

... and the desk number is available as the $d parameter. That's the 
bit I was missing.

---

From: Mikhael Goikhman <[email-masked]>
Date: Fri, 15 Mar 2002 16:59:41 +0000

> I did that while on Desk #4. It renamed Desk #1 and emptied the pager 

What do you mean emptied? You should start the pager as: FvwmPager 0 3.

I have no time to investigate this now, but you may consider "Label *"
not working, it always changes the label of the first desk (number 0).

There are more solutions here. You may use $d instead of "*". There is,
hovewer one unfortunate feature, $d is not expanded in module commands
(otherwise this would break backward compatibility in several modules).
So you should fetch it outside of a module config command. Also there
are two module config commands one in another as you see, so you should
escape some dollars.

In 2.4.* try this. I didn't test it because I have no full config.

*NameDesk: Command SetEnv CURRENT_DESK_NUM $d
*NameDesk: Command *FvwmPager: Label $$[CURRENT_DESK_NUM] $(deskname)
*NameDesk: Command KillModule FvwmPager
*NameDesk: Command Module FvwmPager 0 3

In 2.5.* (use 20020301 snapshot if you like) the solution may be much
cleaner, you don't need to restart any module. You should not use
"*FvwmPager: Label", but a new fvwm command "DesktopName num name".
This command affects desktop names in several places, not just FvwmPager.
This DesktopName command, when called, changes the label of all running
pagers automatically without restarting.

*NameDesk: Command SetEnv CURRENT_DESK_NUM $d
*NameDesk: Command DesktopName $$[CURRENT_DESK_NUM] $(deskname)

There is also a solution with PipeRead, but let's stop here.

Regards,
Mikhael.