From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1GMNyO-0007N8-Sz for garchives@archives.gentoo.org; Sun, 10 Sep 2006 11:59:41 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.8/8.13.6) with SMTP id k8ABx9LB026873; Sun, 10 Sep 2006 11:59:09 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by robin.gentoo.org (8.13.8/8.13.6) with ESMTP id k8ABvCTP009252 for ; Sun, 10 Sep 2006 11:57:12 GMT Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 6AAEE6414C for ; Sun, 10 Sep 2006 11:57:11 +0000 (UTC) Received: from smtp.gentoo.org ([127.0.0.1]) by localhost (smtp.gentoo.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07969-17 for ; Sun, 10 Sep 2006 11:57:05 +0000 (UTC) Received: from sirius.livecd.pl (250-107.unused.derbynet.waw.pl [83.243.107.250]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id 0476B6458E for ; Sun, 10 Sep 2006 11:57:01 +0000 (UTC) Received: from havner by sirius.livecd.pl with local (Exim 4.60) (envelope-from ) id 1GMNvk-00025x-Rs for gentoo-dev@gentoo.org; Sun, 10 Sep 2006 13:56:56 +0200 Date: Sun, 10 Sep 2006 13:56:56 +0200 From: Lukasz Pawelczyk To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] xinitrc/startx scripts unification Message-ID: <20060910115656.GA8051@sirius.livecd.pl> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="a8Wt8u1KmwUX3Y2C" Content-Disposition: inline X-Location: Bialoleka/Poland 52.3000N, 21.1670E User-Agent: Mutt/1.5.11 Sender: X-Virus-Scanned: amavisd-new at gentoo.org X-Spam-Status: No, score=-2.272 required=5.5 tests=[AWL=-0.192, BAYES_00=-2.599, FORGED_RCVD_HELO=0.135, TW_KB=0.077, TW_TX=0.077, TW_XK=0.077, TW_XR=0.077, TW_XS=0.077] X-Spam-Score: -2.272 X-Spam-Level: X-Archives-Salt: e1b21dac-3b11-46fd-b1b7-663e4d5fb41c X-Archives-Hash: b0cd4c6dc913c2becfce77f010772217 --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline I wanted to fill bugzilla report about this but found few existing without neither serious solution nor being current. There is an incosistency in current xinitrc behaviour (i'm only talking about xinitrc run through startx, not {k,g,x}dm). Problems: 1. /etc/X11/xinitrc tries to load xresources and xmodmap but not xkb, this is done only in /etc/X11/Sessions/Xsession so to use it you need to set XSESSION=Xsession (not giving yourself a chance to use chooser for chosing windowmager which is i think it should be used for) 2. neither of them sources /etc/X11/xinit/xinitrc.d not letting f.e. dbus to start in your session 3. /etc/X11/xinitrc tries to load ~/.xinitrc which is absolutely unneccesary as this is done in startx and running ~/.xinitrc from /etc/X11/xinitrc wont ever happen (and it should work this way as ~/.xinitrc should be run on totally clean session, without any resources/modmaps set, for the other case ~/.xsession or ~/.Xclients should be used) 4. Most of this is workarounded f.e. in /etc/X11/Sessions/Gnome which does all whats necessary (xkb, xinitrc.d) but this is just code duplication with /etc/X11/Sessions/Xsession and requires other wm's sessions do the same and they dont. F.e. windowmaker, /etc/X11/Sessions/wmaker only runs wmaker bin, without setting anything. Solution: Completely remove /etc/X11/Sessions/Xsession and merge its functionality with /etc/X11/xinitrc + add sourcing xinitrc.d (see attachment #1). Remove all resource related things from /etc/X11/Sessions/* and make these files only run windowmagers. All other things would be done from /etc/X11/xinitrc for all windowmagers. Gnome session after this should look like attachment #2. All of these changes shouldn't break anything. If someone is setting XSESSION to Xsession to rely on ~/.xsession, /etc/X11/xinitrc will do it by default. If someone set XSESSION to any other windowmanager it will work as well (chooser is still run from /etc/X11/xinitrc) but in addition he'll have properly set enviroment for wm's that dont it themselves (above example of wmaker). The only thing that will change is when someone have both XSESSION set and ~/.xsession created. Now ~/.xsession will have priority over chooser as it should be in my opinion. If you think this is unacceptable its only enough to change order in xinitrc proposed by me. Patch #3 is /etc/X11/Sessions/Xsession against new xinitrc. What do you think about it? If you'd accept it I'd happily review other wm's session files as well. -- Regards Lukas Pawelczyk --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename=xinitrc #!/bin/sh # redirect errors to a file in user's home directory if we can for errfile in "$HOME/.xsession-errors" "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER" do if ( cp /dev/null "$errfile" 2> /dev/null ) then chmod 600 "$errfile" exec > "$errfile" 2>&1 break fi done # clean up after xbanner if which freetemp 2> /dev/null ; then freetemp fi startup=$HOME/.xsession userresources=$HOME/.Xresources usermodmap=$HOME/.Xmodmap userxkbmap=$HOME/.Xkbmap sysresources=/etc/X11/Xresources sysmodmap=/etc/X11/Xmodmap sysxkbmap=/etc/X11/Xkbmap rh6sysresources=/etc/X11/xinit/Xresources rh6sysmodmap=/etc/X11/xinit/Xmodmap # merge in defaults if [ -f "$rh6sysresources" ]; then xrdb -merge "$rh6sysresources" fi if [ -f "$sysresources" ]; then xrdb -merge "$sysresources" fi if [ -f "$userresources" ]; then xrdb -merge "$userresources" fi # merge in keymaps if [ -f "$sysxkbmap" ]; then setxkbmap `cat "$sysxkbmap"` XKB_IN_USE=yes fi if [ -f "$userxkbmap" ]; then setxkbmap `cat "$userxkbmap"` XKB_IN_USE=yes fi # # Eeek, this seems like too much magic here # if [ -z "$XKB_IN_USE" -a ! -L /etc/X11/X ]; then if grep '^exec.*/Xsun' /etc/X11/X > /dev/null 2>&1 && [ -f /etc/X11/XF86Config ]; then xkbsymbols=`sed -n -e 's/^[ ]*XkbSymbols[ ]*"\(.*\)".*$/\1/p' /etc/X11/XF86Config` if [ -n "$xkbsymbols" ]; then setxkbmap -symbols "$xkbsymbols" XKB_IN_USE=yes fi fi fi # xkb and xmodmap don't play nice together if [ -z "$XKB_IN_USE" ]; then if [ -f "$rh6sysmodmap" ]; then xmodmap "$rh6sysmodmap" fi if [ -f "$sysmodmap" ]; then xmodmap "$sysmodmap" fi if [ -f "$usermodmap" ]; then xmodmap "$usermodmap" fi fi unset XKB_IN_USE # run all system xinitrc shell scripts. if [ -d /etc/X11/xinit/xinitrc.d ]; then for i in /etc/X11/xinit/xinitrc.d/* ; do if [ -x "$i" ]; then . "$i" fi done fi if [ -x "$startup" ]; then exec "$startup" elif [ -x "$HOME/.Xclients" ]; then exec "$HOME/.Xclients" # If not present, try the system default elif [ -n "`/etc/X11/chooser.sh`" ]; then exec "`/etc/X11/chooser.sh`" elif [ -x /etc/X11/xinit/Xclients ]; then exec /etc/X11/xinit/Xclients elif [ -x /etc/X11/Xclients ]; then exec /etc/X11/Xclients # Failsafe else # start some nice programs twm & xclock -geometry 50x50-1+1 & xterm -geometry 80x50+494+51 & xterm -geometry 80x20+494-0 & exec xterm -geometry 80x66+0+0 -name login fi --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename=Gnome #!/bin/sh # Great new Gnome2 feature, AA # We enable this by default export GDK_USE_XFT=1 if [ -x "$HOME/.gnomerc" ]; then command="$HOME/.gnomerc" elif [ -x /etc/X11/gdm/gnomerc ]; then command="/etc/X11/gdm/gnomerc" else # as fallback in case the config is screwed command=`which gnome-session` fi sshagent=`which ssh-agent` if [ -n "$sshagent" ] && [ -x "$sshagent" ] && [ -z "$SSH_AUTH_SOCK" ]; then command="$sshagent -- $command" fi exec $command --a8Wt8u1KmwUX3Y2C Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename="xinitrc.diff" --- /usr/portage/x11-apps/xinit/files/Xsession 2005-08-14 02:12:39.000000000 +0200 +++ xinitrc 2006-09-10 13:50:51.000000000 +0200 @@ -1,14 +1,4 @@ #!/bin/sh -# $XConsortium: Xsession /main/10 1995/12/18 18:21:28 gildea $ - -case $# in -1) - case $1 in - failsafe) - exec xterm -geometry 80x24-0-0 - ;; - esac -esac # redirect errors to a file in user's home directory if we can for errfile in "$HOME/.xsession-errors" "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER" @@ -94,14 +84,32 @@ unset XKB_IN_USE +# run all system xinitrc shell scripts. +if [ -d /etc/X11/xinit/xinitrc.d ]; then + for i in /etc/X11/xinit/xinitrc.d/* ; do + if [ -x "$i" ]; then + . "$i" + fi + done +fi + if [ -x "$startup" ]; then exec "$startup" elif [ -x "$HOME/.Xclients" ]; then exec "$HOME/.Xclients" +# If not present, try the system default +elif [ -n "`/etc/X11/chooser.sh`" ]; then + exec "`/etc/X11/chooser.sh`" elif [ -x /etc/X11/xinit/Xclients ]; then exec /etc/X11/xinit/Xclients elif [ -x /etc/X11/Xclients ]; then exec /etc/X11/Xclients +# Failsafe else - exec xsm + # start some nice programs + twm & + xclock -geometry 50x50-1+1 & + xterm -geometry 80x50+494+51 & + xterm -geometry 80x20+494-0 & + exec xterm -geometry 80x66+0+0 -name login fi --a8Wt8u1KmwUX3Y2C-- -- gentoo-dev@gentoo.org mailing list