Subject: FVWM: how to start up xterms and applications with a session manager

From: Adrian Mariano <[email-masked]>
Date: Wed, 01 Dec 2004 09:55:31 -0500

I'm in the process of upgrading an old Linux system.  On the old system, 
the window manager was
started by a .xinitrc file which started up xbiff, xclock, some xterms, 
etc, and then finally ran the window
manager. 

I just installed a Debian linux version, and as far as I can tell, there 
is no script analagous to .xinitrc that
gets executed unless I disable the automatic window manager selection in 
the session manager.  The
session manager has a system where you pick your window manager off a 
menu and it runs it. 
It only runs .xsession if it can't find your window manager.  It would 
appear, therefore, that the only
way to get startup applications run is to have fvwm start them. 

When I look at the fvwm manual I find a description of InitFunction, 
which sounds like the right
thing.  And the description says "These functions may be customized in a 
user's /.fvwm2rc/ file via
the *AddToFunc* command (described later) to start up modules, xterms, 
or whatever you'd like to
have started by fvwm.."  Sounds great.  But I'm using a session manager 
and a little farther down
I find "If fvwm is run under a session manager, functions 
*SessionInitFunction* and *
SessionRestartFunction* are executed instead of InitFunction and 
RestartFunction." 
Ok.  Whatever.  But then I encounter the vague warning:

Generally it is a bad idea to start xterms or other applications in 
"Session*" functions

And that's it.  There is no further explanation of either why it's bad 
idea or how, in fact, I'm
supposed to start up my xterms if I can't use SessionInitFunction to do 
it. 

Note: please CC me when you reply as I am not on the list. 

--
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: Wed, 01 Dec 2004 10:15:43 -0500

> way to get startup applications run is to have fvwm start them. 

I hate session managers.

Do man inittab.

Change from runlevel 5 to runlevel 3 and your life will be
greatly simplified.

-- 
Dan Espen                           E-mail: [email-masked]

---

From: Thomas Adam <[email-masked]>
Date: Wed, 1 Dec 2004 15:24:53 +0000

On Wed, Dec 01, 2004 at 10:15:43AM -0500, Dan Espen wrote:

> I hate session managers.
>
> Do man inittab.
>
> Change from runlevel 5 to runlevel 3 and your life will be greatly
> simplified.

Actually, that's entirely inaccurate. Debian doesn't use the RH-ism of
reserving runlevel 3 for non-GUI and runlevel 5 for GUI. In debian
runlevels 2->5 inclusive will launch some form of DM, if it is
installed.

To answer the querent directly, what you probably want to do, is:

update-alternatives --config x-session-manager
update-alternatives --config x-window-manager

This will change it globally, and x-session-manager takes precedence
over x-window-manager unless it is configured by the user. This depends,
of course, as to which display manager you use. KDM and GDM AFAIK have
to be coerced into using ~/.xsession (which is where you place all of
your commands to start up, including the session manager). XDM and
startx use ~/.xsession by default.

You might also find [1] of interest.

-- Thomas Adam

[1] http://linuxgazette.net/100/adam.html

-- 
I know nothing, and understand even less.

---

From: Adrian Mariano <[email-masked]>
Date: Wed, 01 Dec 2004 11:11:16 -0500

Lars Segerlund wrote:

> I think you're looking for .xsession ( check it up ).
>

I tried .xsession before mailing the list.  As noted below, all the evidence 
suggests that .xsession will not be executed if the display manager finds a 
window manager to start up.

> A better way with a modern fvwm would be to have fvwm start it from it's init.hook ( in the configuration files for fvwm ).
>

The file init.hook does not appear to be mentioned in the fvwm documentation.  I searched
for on with google and did find a reference wherein somebody reads this file with 
InitFunction in the .fvwm2rc file.  

>[1] http://linuxgazette.net/100/adam.html
Reading [1] was actually very enlightening as it cleared up a 
fundamental confusion I
suffered from.  I don't want a session manager!  (My desktop gets more 
and more
cluttered until I finally log out and start fresh.  A session manager to 
preserve the clutter
is not what I need.)  I was thinking that the display manager was the 
session manager. 
Of course it makes sense that you wouldn't want to start up a bunch of 
apps if you were
using a session manager since presumably the session management is going 
to be starting
up the saved session.

>startx use ~/.xsession by default.
Right now KDM is installed.  There is an elaborate script system with 
scripts in /etc/X11/Xsession.d
(I think) which resembles the rc.d startup scripts.  The scripts are 
numbered and run in order, and one
of these scripts will run the user .xsession file but only if a window 
manager wasn't already started by
a previous script.  I could insert a script in this sequence to force 
the system to run a user .xsession
file (or modify the existing script to always run that file).  But I 
guess I presumed there was a more
natural way to do it.  I don't know what program is responsible for 
running all of these xsession scripts.
The current setup where the display manager gives a menu of window 
managers and it is possible to
select Gnome or KDE may be useful to me for some other occasional users 
of the system. 
I'll look into update-alternatives.  It's not obvious what the effect of 
designating a window manager
would be for the current setup where there is a menu of several.  

I don't have access right now to the system in question, so I can't test 
anything out, but it appears
that I should be able to avoid using a session manager and to use the 
InitFunction command in the
.fvwm2rc file to start whatever stuff I want, either directly or through 
loading a file such as the
init.hook file mentioned above.  Is this the right approach?   Or is it 
preferable to arrange somehow
that the user .xsession file gets executed (before?) the window manager 
is started.

---

From: Thomas Adam <[email-masked]>
Date: Wed, 1 Dec 2004 16:23:43 +0000

On Wed, Dec 01, 2004 at 11:11:16AM -0500, Adrian Mariano wrote:

> I tried .xsession before mailing the list. As noted below, all the
> evidence suggests that .xsession will not be executed if the display
> manager finds a window manager to start up.

This is wholly inaccurate. You have to tell ~/.xsession what it is to
do. Again, see [2].

> manager wasn't already started by a previous script. I could insert a
> script in this sequence to force the system to run a user .xsession

You need to read the scripts in more detail. ~/.xsession takes
precedence over /etc/X11/Xsession.d/* should it exist. This has always
been the case. Again, see [2,3].

> I don't have access right now to the system in question, so I can't
> test anything out, but it appears that I should be able to avoid
> using a session manager and to use the InitFunction command in the
> .fvwm2rc file to start whatever stuff I want, either directly or
> through loading a file such as the init.hook file mentioned above. Is
> this the right approach? Or is it preferable to arrange somehow that
> the user .xsession file gets executed (before?) the window manager is
> started.

You can do it both ways. The only advantage of putting them in
~/.xsession rather than allowing fvwm to start them is because the apps
in ~/.xsession persist across different window managers / desktop
environments, should you ever change them.

-- Thomas Adam

[2] http://www.hantslug.org.uk/cgi-bin/wiki.pl?LinuxHints/StartX
[3] http://linuxgazette.net/105/tag/2.html

---

From: Adrian Mariano <[email-masked]>
Date: Wed, 01 Dec 2004 12:40:37 -0500

>This is wholly inaccurate. You have to tell ~/.xsession what it is to
I'm not sure what you mean by "have to tell ~/.xsession what it is to 
do".  My observations of
the actual behavior my system is that it didn't matter if the file was 
called ~/.xsession, ~/.Xsession
or ~/.xinitrc.  In all cases the contents of the file were NOT executed 
unless I explicitly ran it
after fvwm started up.  I'm not sure how to reconcile this observation 
with the
claim above.  The file does have execute permission.  Item [2] talks 
about using startx and
hence doesn't apply to my (current) setup where kdm is used. 

>been the case. Again, see [2,3].
Those references seem to indicate that some display managers do not, in 
fact, run the ~/.xsession,
though kdm wasn't explicitly mentioned.  As an example that people 
typically find that kdm does
not run ~/.xsession I note 
http://neon.polkaroo.net/~mhoye/blarg/archives/001645.php where
somebody pursues the other solution I had noted above of adding stuff to 
/etc/X11/Xsession.d. 

I'm a little hazy on what exactly would be responsible for running 
~/.xsession in the quoted
situation described above.  On my system there exists (I think) a 
/etc/X11/Xsession which
doesn't look in ~.   Then there is /etc/X11/Xsession.d/* which has something
like 5 scripts in it.  One of them checks whether a window manager was 
selected and if not,
looks for ~/.xsession and runs it if it exists.  This would be an odd 
thing to do if ~/.xsession
was run instead of /etc/X11/Xsession.d/*, since then ~/.xsession would 
not exist if the
/etc/X11/Xsession.d/* files were being executed. 

It would appear therefore that I have four possible avenues, which I 
summarize here for
the archives:
1. Add something to /etc/X11/Xsession.d
2. Use InitFunction in the ~/.fvwm2rc
3. Use startx or maybe xdm instead of kdm so that ~/.xsession is used to 
control window manager,
    and perhaps combine this with wmselect if I want to select between 
different window managers
4. Use the "default" setting (?) on kdm which causes ~/.xsession to be used

>[3] http://linuxgazette.net/105/tag/2.html
It seems to me that this is getting somewhat off topic for a list 
devoted to fvwm, so I have
set the reply-to in an effort to take further discussion (should any 
occur) off the list.
Thanks to those who took the time to reply to my query.

---

From: Micha Feigin <[email-masked]>
Date: Fri, 03 Dec 2004 02:25:41 +0200

At Wed, 01 Dec 2004 09:55:31 -0500,
> way to get startup applications run is to have fvwm start them. 

I think you need to use ~/.xsession instead of .xinitrc (not sure) and then you
choose default window manager and it should run /etc/X11/Xsession which looks
for ~/.xsession. Works for me with wdm at least IIRC also KDM but haven't used
it for a while.

>  +++++++++++++++++++++++++++++++++++++++++++
>  This Mail Was Scanned By Mail-seCure System
>  at the Tel-Aviv University CC.
>