[TAG] [vsesto at adelphia.net: Re: Mozilla and FVWM question]
thomas at edulinux.homeunix.org
Fri Nov 18 20:38:45 MSK 2005
On Thu, Nov 17, 2005 at 07:53:22AM +0000, Thomas Adam wrote:
> From: vsesto at adelphia.net
> I have two different mozilla profiles loaded. But this is the special
> sequence of events that I need to occur ... I think this can be done
> via FVWM vs a perl script or program.
It can -- but just how useful is it? It's a rather specific thing to do
--- and I am interested in why you're needing this approach.
> 1. Clobber the .mozilla directory for a particular profile in essence
> a "rm -rf .mozilla/xxxxx.slt/profile1 " type of command.
When does this happen? Before mozilla starts?
> 2. Copy a "known" or "virgin" .mozilla directory where the one I
> removed existed. In essence it is the EXACT same profile every time
> ... but after the remove it puts it in a known state ... no history /
> cookies or whatever (who cares right?)
I don't know -- but I am assuming you must be running some sort of kiosk
> As an aside ... I am actually un-tar'ing a mozilla-default-profile.tgz
> file to the .mozilla directory
> 3. So now I simply want to start mozilla on a specific desktop
> ... we've covered this a bit with the SkipMapping & using the
> _MOZILLA_PROFILE atom to determine which profile I am trying to exec.
> 4. So now I am happy and running along merrily ... now I want to close
> the app ... and key off the fact that it is now terminated ... once
> this occurs I would like the process to start all over again as in 1)
> ... this way the next guy gets a fresh known starting point profile
> I envision this can be done with Functions & Events ... can you shed
> some light on how to do this in FVWM?
Quite. The ultimate one that would come close to what you want is the
'destroy_window' event. Essentially this event is triggered when a
window is destroyed (it gets called when the window receives the event
-- and enters into the unmapped state.) So the first part of the event
would look like this:
DestroyModuleConfig FE-dw: *
*FE-dw: Cmd Function
*FE-dw: destroy_window CheckWindow
... this just sets up the event for FvwmEvent, using an alias of
'FE-dw'. At this point in its declaration, nothing has been told to use
it yet -- so the event definition above could be bound to any Fvwm
module I chose --- although given the syntax above, it's clear it's for
So, what will happen, is that when a destroy_window event occurs, the
FvwmEvent module will call 'CheckWindow'. This is a function we're
about to declare to do some checking for us, hence:
+ I ThisWindow (!Transient, somename) Exec exec somename
... means that for the window that was just destroyed -- check that it
wasn't transient, and also check that the name (or class) of the window
was called 'somename'. If those match, then run the command after it
-- which in this case, will exec the 'somename' program.
Then we just tell FvwmEvent to load with the alias we've specified,
Module FvwmEvent FE-dw
Of course, the question you'll want to know, is how do you which
instance of Mozilla died -- and more importantly which profile to use?
Well, there's an easy answer to that. Assuming a specific profiled
mozilla runs on a specific desk, then your function might look like
+ I ThisWindow (!Transient, Mozilla) PipeRead `[ \
"$[w.desk]" == "0" ] && echo "Exec exec mozilla -profile foo" || \
[ "$[w.desk]" == "1" ] && echo "Exec exec mozilla -profile foo2"
Which essentially says, something like this: "If the window called with
destroy_window wasn't transient, and called Mozialla, then check to see
which desk it was on. If it was on desk 0, re-run it using profile
'foo', else if it was on desk 1, re-run it using profile 'foo2'".
> 1. Remove the pertient .mozilla folder 2. tar -xvzf
In your PipeRead statement, just add:
[ -d $[HOME]/.mozilla ] && rm -fr $[HOME]/.mozilla && \
tar xzvf $[HOME]/mozilla-default.tgz
-- Thomas Adam
I don't want to stay. I want to go home.
More information about the TAG