User-Agent: Build Identifier: Gdm and kdm allow users to select the session to be started. This bypasses the ~/.xsession file. This file is the file that traditionally gets used for starting a window manager and personal favourite apps. gdm and kdm use the directory /etc/X11/Sessions/ where each script represents a different session. The scripts from this directory don't source .xsession as that would start a second window manager. This means there should be another file to allow users to start programs like ~/.xsession and ~/.bash_profile . A solution would be to make a DMSession script is sourced from the various session scripts. This DMSession script then conditionally sources a /etc/X11/dmprofile and a ${HOME}/.dmprofile script (based on existence). Those scripts would be the place from which gpg-agent or XInput programs could be started, as well as user specific scripts Reproducible: Always Steps to Reproduce: 1. 2. 3.
Should be WM specific if you ask me. Like /etc/X11/Sessions/Gnome uses .gnomerc
While this is basically wm dependant, it is a bug involving ALL window managers. This bug intends to get a decision on a general architecture, after which bugs on different windowmanagers can be posted. The rationale for such a script is both aegypten. For that to work gpg-agent needs to be started and an environment variable needs to be set. Basically the same is valid for XInput input methods such as kanna, xcin etc. They need all be started as the user and before any application is started. This is the place for that.
Created attachment 10430 [details] An ebuild that allows for pre and post session scripts. I made scripts that are helpfull in doing pre and post X session scripts. The scripts execute all (executable) scripts in the /etc/X11/{pre,post}session.d dirs, unless the user as a persional .{pre,post}session script. They need support from the display manager, see the other attachments following
Created attachment 10431 [details] changes to the gdm ebuild and a small source patch to allow pre/post session scripts Small changes to gdm so that we can have presession scripts that give their environment to the actual X session. The session scripts and the session are now executed through a small wrapper. They cannot be started through gdm's presession and postsession parts as those are executed as root. That is obviously not safe.
Created attachment 10432 [details, diff] A patch to the xfree Xsession script to allow for pre/post session scripts This is a patch to the Xsession scripts for both 4.2.1-r2 and 4.3.0 (they are the same). This patch changes the Xsession script in by sourcing the presession script. Changing the execution of the actual session to a non-exec invocation (so that we get a chance to do postsession things) and sourcing the postsession script.
Created attachment 10433 [details] newpg.zip - A new version of newpg that uses a presession script to start gpg-agent This is an "example" use of the session scripts of the previous attachments. This finally makes installing aegypten support for kmail easy.
I though I might as well make an implementation of what I mean. I just submitted 3 attachments that implement pre and post session scripts in gdm/kdm and xdm. The other attachment is a new version of newpg (contains gpg-agent which is necessary for the new style gpg support in kmail) that uses the scripts. For gdm I made a small change to the source. This is to prevent needing to change all the session scripts of all window managers. The rationale for the pre/post sesion work is that there are programs that one might want to use for all users of a host, with all window managers. But that need to run before the window manager. The solution to edit all session scripts is not a real solution as these scripts change with a new version of the window manager (at least in case of kde), and it makes the functioning dependant on correctness of the windowmanagers (of which there are many). I believe the most use is in the presession script (like with the .bashrc), but the postsession script can very well be used as a cleanup script (like .bash_logout). If there are things that are not clear about these patches, please ask.
I'm going to look at it too, I was planning to do something about it but was unaware of this bugreport... Not today though :-)
Well try it out / take a look at it. I would like to hear your comments.
Could we make it '/etc/X11/PreSession.d' and /etc/X11/PostSession.d, as it will fit better with /etc/X11/Sessions ?
Also, for gdm it should be possible to just change /etc/X11/gdm/PreSession/Default and /etc/X11/gdm/PostSession/Default ....
about comment #10, I see no problems with that. It's just that I don't like typing capitals ;-) about comment #11. That is not possible as the gdm pre/post session scripts are run as root. You don't want that. Also for the presession to be able to pass through environment variables it must not be started from the presession script. Actually I first tried to put the things in the gdm pre/post session scripts, but I then found out it didn't work for the presession, and was unsafe for the postsession. (I almost submitted the patches with unsafe postsession)
I've recently needed this exact functionality on my system - what is the progress on this bug? as far as i can see, the functionality hasnt yet found its way into any of the default ebuilds - any indication on when this will happen? thanks in advance David ac
Martin (azarah) has confirmed that he will look into it, but I guess that he is currently busy with other things. Please feel free to try the patches. I've put them together in http://www.cs.kun.nl/~pauldv/ebuilds/presession.zip. I currently don't have access to that server (firewall restrictions) so I cannot update it. It's xfree ebuild is dated. Basically what you need to do is copy the files from the portage archive, and replace only the XSession file with the one from my archive. Tonight I'll update the archive to contain an updated xfree ebuild. If you have any questions about these ebuilds, feel free to ask them
Ok, with gnome-2.6 and kde-3.2 this problem has solved itself. Both include their own Xsession script that uses /etc/xprofile and ~/.xprofile for x specific hooks. This is similar to what the presession scripts do, the post-session scripts are not that necessary so I'll close this for now. I'll make a nice package for session support new style, and have newpg depend on it. That should make things go well.