Subject: FVWM: fvwm2rc + restart

From: John Smith <[email-masked]>
Date: Tue, 2 Apr 2002 15:27:13 -0800

Hey, I was thinking about something as I was rewriting part of my
configuration, and I thought it would be neat if there were an option in fvwm2
where you can have fvwm2 automatically reload when you change the .fvwm2rc.
If no option like that exists, what do you think about it?

Thanks

--
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: Perry Hutchison <[email-masked]>
Date: Tue, 2 Apr 2002 15:42:25 -0800 (PST)

> Hey, I was thinking about something as I was rewriting part of
> my configuration, and I thought it would be neat if there were
> an option in fvwm2 where you can have fvwm2 automatically reload
> when you change the .fvwm2rc.  If no option like that exists,
> what do you think about it?

There a couple of practical concerns.

* In order to do this, fvwm2 would have to periodically "stat" the
  .fvwm2rc file and check for the date and/or size having changed.  If
  the stat were done only occasionally, there would be a delay between
  updating the file and the auto-restart.  If done frequently, it
  would become a significant overhead in its own right.

* How would you avoid a race condition, wherein fvwm2 sees the changed
  file and decides to restart halfway through a rewrite?  Most text
  editors don't lock files while writing them.
--
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: szonyi calin <[email-masked]>
Date: Wed, 3 Apr 2002 08:43:12 +0200 (CEST)

--- Perry Hutchison
<[email-masked]> a écrit : > > Hey,
I was thinking about something as I was
> rewriting part of

Well, as far as i know there is one wm which does it
and does it well -- olvwm (olwm). I don't know 
what method it uses but it's not slow. Of course 
olvwm doesn't have the complexity of fvwm2 :-)
And in .olvwm you don't have pixmaps and fonts 
which will slow things down. 
Maybe using the style of olvmw to specify fonts
and pixmaps will help (i.e. through X resource
mechanism)

One of the annoing things of doing restart is that 
fvwm allways seem to start on the firs page of the 
desk and you have to change the desk (page) to get
back where you were before restart.

=====
--------------------------------------------
                         ,-----.
                       ," ^   ^ ",
                       |  @   @  |
             ----OOOO---------------OOOO----

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
--
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: Uwe Pross <[email-masked]>
Date: Wed, 3 Apr 2002 09:58:30 +0200

>   editors don't lock files while writing them.

How about adapting an editor for example  (x)emacs  that  it  restarts
fvwm2  after saving the file .fvwm2rc. In emacs there is a hook called
after-save-hook. It contains names of functions which will be executed
after  a  buffer has been saved. One could write a short lisp function
which checks the buffer name and executes "FvwmCommand  'Restart'"  if
buffer name is .fvwm2rc. 
One could also think about a mechanism which detects only the  changes
in  .fvwm2rc  and  decides if a restart is necessary or if the changes
can be directly piped to  FvwmCommand.  For  example  if  only  a  key
binding  has  been  changed  it is sufficient to pipe only the the Key
command to FvwmCommand. 

Uwe
-- 
+--------------------------------------------------
| Uwe Pross 
| mail : mailto:[email-masked]
| www  : http://www.tu-chemnitz.de/~uwp
+--------------------------------------------------
--
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: Wed, 3 Apr 2002 11:41:59 +0200

> If no option like that exists, what do you think about it?

You can easily do that without patching fvwm with a shell script:

-------------------------------- snip -------------------------------
#!/bin/sh

FVWMCONFIG="$HOME/.fvwm/.fvwm2rc"

# find out fvwm's process id
FVWMPID=`...`

while true; do
    # set to 1 if the file changed
    FILE_CHANGED=`...`
    if [ "$FILE_CHANGED" = 1 ]; then
        # restart fvwm
        kill -usr1 $FVWMPID
    fi
    sleep 5
done
-------------------------------- snip -------------------------------

You have to write the `...` according to what you need, though.

Bye

Dominik ^_^  ^_^

-- 
Dominik Vogt, email: [email-masked]
LifeBits Aktiengesellschaft, Albrechtstr. 9, D-72072 Tuebingen
fon: ++49 (0) 7071/7965-0, fax: ++49 (0) 7071/7965-20
--
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: Uwe Pross <[email-masked]>
Date: Wed, 3 Apr 2002 12:58:32 +0200

> which checks the buffer name and executes "FvwmCommand  'Restart'"  if

With the message from Dominik the following lisp statement restarts
fvwm after .fvwm2rc has been saved:

(add-hook 'after-write-file-hooks 
	  '(lambda () 
	     "restarts fvwm2 if the buffer .fvwm2rc has been saved"
	     (interactive)
	     (if (string-equal (buffer-name) ".fvwm2rc") 
		 (progn
		   (message "Restarting fvwm2 ...")
		   (shell-command "kill -USR1 `ps -u $USER | grep fvwm2 | awk '{ print $1 }'`" )))))

Uwe

---

From: Mikhael Goikhman <[email-masked]>
Date: Wed, 3 Apr 2002 13:09:17 +0000

> and pixmaps will help (i.e. through X resource

FVWM is far more complex. It is not even static. Decorations, fonts,
colors, menus, bindings, even functions themselves can be changed
dynamically at any time. I.e. you may press a button and everything will
be changed without a restart.

> back where you were before restart.

Restart preserves the current page and desk. And many other global and
window attributes like window shade-ness.

You probably use "Restart --dont-preserve-state". Don't use this switch
if you like to preserve the state before Restart.

Regards,
Mikhael.

---

From: Tim Downie <[email-masked]>
Date: Wed, 03 Apr 2002 15:30:54 +0100

> if you like to preserve the state before Restart.

I find the same problem as szonyi but I certainly don't use
--dont-preserve-state

I use
Restart fvwm2
enabled via pop up menus
and If I use
Restart --preserve-state
that doesn't help either.

Cheers
Tim

-- 
Tim Downie
Dept. Statistical Science
University College London
Gower Street, London WC1E 6BT
Work Phone: 02076791855
Work Fax:  020 7383 4703

---

From: Mikhael Goikhman <[email-masked]>
Date: Wed, 3 Apr 2002 21:50:11 +0000

> I find the same problem as szonyi but I certainly don't use

This is generally incorrect. Starting from 2.3.x it should be simply
"Restart". I can only guess what "Restart fvwm2" does on your sistem.
It depends on your $PATH if you have more than one installation. There
are also other issues described in the man page. Please use the correct
form "Restart". Unless you want to restart to a different WM, of course.

> that doesn't help either.

I hope you use 2.4.x or greater. I can't reproduce this problem.

Is it possible your home directory is not writable? This is needed to
create the restart state file.

Open FvwmConsole window and type in it:

  Exec xmessage $v  # or "Exec echo $v" if you don't have xmessage
  Style FvwmConsole Sticky  # this is good to have in .fvwm2rc
  GotoDeskAndPage 1 1 1
  Restart

Report results, including any message written to the standard error.

Regards,
Mikhael.