Date: Wed, 22 Apr 1998 20:56:51 +0100 From: Nik Clayton <nik@nothing-going-on.demon.co.uk> To: David Wolfskill <dhw@whistle.com>, freebsd-newbies@FreeBSD.ORG Subject: Re: Eureka! Pasting into netscape Message-ID: <19980422205651.12274@nothing-going-on.org> In-Reply-To: <199804221426.HAA00475@pau-amma.whistle.com>; from David Wolfskill on Wed, Apr 22, 1998 at 07:26:11AM -0700 References: <199804221426.HAA00475@pau-amma.whistle.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Apr 22, 1998 at 07:26:11AM -0700, David Wolfskill wrote: > >...I think I hit power switch about five times > >(ouch!) before learning that ctrl-alt-backspace will get you out of X :-( > > As far as I know, that's a peculiarity of FreeBSD; I've never seen it in > other UNIX environments... and it's something that I find exceptionally > counter-intuitive. Nope. It's a peculiarity of your X setup. You generally only use C-A-B when your window manager hangs (or something else goes wrong) with your X server. You can turn this option off with something like Section "ServerFlags" DontZap EndSection in your XF86Config file (as shown in the XF86Config(5) man page). If you run X using 'startx', the contents of the xinitrc file are run. This is either the system xinitrc file or the .xinitrc file in your home directory, if it exists. (.)xinitrc is a /bin/sh script. When it ends, your X session ends. It is customary to use this script to configure your X environment, run a few XTerms (in the background), and then run your window manager (in the foreground). This means that your window manager is the last process started from (.)xinitrc, and since it hasn't quit yet, (.)xinitrc hasn't finished, which means that X keeps going. When you shutdown your WM (fvwm, afterstep, twm, whatever) the (.)xinitrc file keeps going. But there's nothing more for it to do, so it finishes, so X finishes. This is not the only way to do it. Some people run the WM in the background, and run xterm (or similar) last, probably with a different coloured background, or specific title bar. When they exit from this xterm then their X session ends, regardless of what their WM chose to do. Assuming you wanted to work this out from first principles (as I did, about 4 or 5 years ago at university), your thought processes might run as follows: OK, I start X by typing 'startx'. I wonder what actually does? First thing to do is to find out where that program is stored. # which startx /usr/X11R6/bin/startx That's a start. Now, is this a binary program (in which case I need the source code to figure out what it's doing) or is it a shell script? If it's a shell script I can look at it to see what's going on. # file /usr/X11R6/bin/startx /usr/X11R6/bin/startx: Bourne shell script text Good, it's a text file. Lets have a look at it. # less /usr/X11R6/bin/startx [snip] # $XConsortium: startx.cpp,v 1.4 91/08/22 11:41:29 rws Exp $ # # This is just a sample implementation of a slightly less primitive # interface than xinit. It looks for user .xinitrc and .xserverrc # files, then system xinitrc and xserverrc files, else lets xinit choose # its default. The system xinitrc should probably do things like check # for .Xresources files and merge them in, startup up a window manager, # and pop a clock and serveral xterms. # # Site administrators are STRONGLY urged to write nicer versions. # userclientrc=$HOME/.xinitrc userserverrc=$HOME/.xserverrc sysclientrc=/usr/X11R6/lib/X11/xinit/xinitrc sysserverrc=/usr/X11R6/lib/X11/xinit/xserverrc [snip] Well, that's interesting. The comment tells me what it's doing, and it also helpfully lists the locations of the system wide config files. This is useful, because if I don't have a .xinitrc file in my home directory, I can copy the system one to my home directory and modify it to see what happens. If I screw things up too badly, I can just delete .xinitrc in my home directory and the system will go back to its default behaviour. That's a useful safety net. I can also see that the last line of this script is xinit $clientargs -- $serverargs which (after reading the code on the previous lines) indicates that in the default case of just typing 'startx', the final command run by this script will be xinit /usr/X11R6/lib/X11/xinit/xinitrc -- /usr/X11R6/lib/X11/xinit/xserverrc Continuing our detective hunt, we can now look in the manual page for xinit(1). This includes a couple of useful paragraphs: [snip] An important point is that programs which are run by .xinitrc should be run in the background if they do not exit right away, so that they don't prevent other programs from starting up. However, the last long-lived program started (usually a window manager or terminal emulator) should be left in the foreground so that the script won't exit (which indicates that the user is done and that xinit should exit). [snip] which is pretty much what I said earlier, and [snip] Below is a sample .xinitrc that starts a clock, several terminals, and leaves the window manager running as the ``last'' application. Assuming that the window manager has been configured properly, the user then chooses the ``Exit'' menu item to shut down X. [snip] and also [snip] Another approach is to write a script that starts xinit with a specific shell script. Such scripts are usually named x11, xstart, or startx and are a convenient way to provide a simple interface for novice users: [snip] Which seems to cover it all pretty nicely. Hope that's useful. N -- Work: nik@iii.co.uk | FreeBSD + Perl + Apache Rest: nik@nothing-going-on.demon.co.uk | Remind me again why we need Play: nik@freebsd.org | Microsoft? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-newbies" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980422205651.12274>