Depending on what kind of X11 Session you run -- Gnome, KDE, Enlightment, etc. -- different non-desktop-environment specific things get done. I think it would be good to unify all session startups. Besides starting Gnome, the /etc/X11/Sessions/Gnome script * merges system wide Xresources and Xmodmaps * merges user Xresources and Xmodmaps * runs scripts in /etc/X11/xinit/xinitrc.d/ All things which are very convenient. But for example KDE's Session script does nothing of these things. I think the session starts should be unified. Let them all merge the Xresources and Xmodmaps, and all should execute the xinitrc.d scripts. I see no reason why a Gnome session should do these things but a KDE or Enlightment session not. Gentoo's /etc/X11/xdm/Xsession script also has code to merge Xresources and Xmodmaps but executes this only when /etc/X11/chooser.sh doesn't return a session string (so there is a bit code duplication in Xsession and Sessions/Gnome). Maybe it's a good idea to split the non-gnome specific code from Gnome's Session script (i.e. Xmodmap loading, Xresource merging, xinitrc.d scripts) into small scripts under /etc/X11/xinit/xinitrc.d/ and have code in Xsession to run these scripts before chooser.sh is called. Then all non-desktop-environment-specifig code in the Sessions scripts can be removed. Advantages would be: * no code duplication (like currently in Xsession and Sessions/Gnome) * all session startups (KDE, Gnome, xinit, etc.) behave the same * very flexible - just add or delete scripts unter /etc/X11/xinit/xinitrc.d/ to modify startup behaviour. No need to modify the Session scripts or Xsession or chooser.sh. * other ebuilds (like imwheel) could easily install small scripts under xinitrc.d to start during session startup.
Please take a look too at bug #14872, and say what you think about that.
To have pre- AND postsession scripts is even better. But the patches as they are in #14872 don't change the different behaviour/code duplication of Xsession and KDE/ Gnome session scripts (which was not subject of that bug report at all). But they are IMO a very good start. If such a mechanism is implemented, i.e. having scripts in /etc/X11/PreSession.d/ and /etc/X11/PostSession.d/ (as Martin Schlemmer suggested) which get executed before or after the session, it's easy to unify startup behavior of the various desktop environments. All it needs then is to move non-desktop specific code from the session scripts (like in Gnome's session script) and the Xdefaults/Xmodmap stuff from Xsession into small scripts under /etc/X11/PreSession.d/. And the suggested DMSession script can also take the form of small /etc/X11/{Pre,Post}Session.d/ scripts which then execute systemwide or user specific things. Hmm .. I feel a bit silly. I did a bugzilla search for xinitrc and session, etc. but somehow managed to overlook bug #14872 , otherwise I would have posted a comment there.
In the current kdm and gdm this is partially implemented as sourcing ~/.xprofile.
*** Bug 53517 has been marked as a duplicate of this bug. ***
comment #3: True, for the user. But I agree that it'd be nice to have scripts for the system. Think /etc/env.d vs. ~/.bashrc and ~/.profile I'm in favor of this proposal.
Nearly 5 years after this bug was opened, it seems no-one cares about merging those scripts anymore. In any case, patches will of course be welcome by the X11 herd, but this is very very low on our TODO list. Thanks