slackware-current/slackbook/html/x-window-system-xinitrc.html
Patrick J Volkerding 75a4a592e5 Slackware 13.37
Mon Apr 25 13:37:00 UTC 2011
Slackware 13.37 x86_64 stable is released!

Thanks to everyone who pitched in on this release: the Slackware team,
the folks producing upstream code, and linuxquestions.org for providing
a great forum for collaboration and testing.

The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a
dual-sided
32-bit/64-bit x86/x86_64 DVD.  Please consider supporting the Slackware
project by picking up a copy from store.slackware.com.  We're taking
pre-orders now, and offer a discount if you sign up for a subscription.

As always, thanks to the Slackware community for testing, suggestions,
and feedback.  :-)

Have fun!
2018-05-31 22:45:18 +02:00

145 lines
5 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>xinitrc</title>
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
<link rel="HOME" title="Slackware Linux Essentials" href="index.html" />
<link rel="UP" title="X Configuration" href="x-window-system.html" />
<link rel="PREVIOUS" title="xorgsetup" href="x-window-system-xorgsetup.html" />
<link rel="NEXT" title="xwmconfig" href="x-window-system-xwmconfig.html" />
<link rel="STYLESHEET" type="text/css" href="docbook.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"
alink="#0000FF">
<div class="NAVHEADER">
<table summary="Header navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<th colspan="3" align="center">Slackware Linux Essentials</th>
</tr>
<tr>
<td width="10%" align="left" valign="bottom"><a href="x-window-system-xorgsetup.html"
accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">Chapter 6 X Configuration</td>
<td width="10%" align="right" valign="bottom"><a href="x-window-system-xwmconfig.html"
accesskey="N">Next</a></td>
</tr>
</table>
<hr align="LEFT" width="100%" />
</div>
<div class="SECT1">
<h1 class="SECT1"><a id="X-WINDOW-SYSTEM-XINITRC" name="X-WINDOW-SYSTEM-XINITRC">6.3
xinitrc</a></h1>
<p><tt class="COMMAND">xinit</tt>(1) is the program that actually starts X; it is called
by <tt class="COMMAND">startx</tt>(1), so you may not have noticed it (and probably don't
really need to). Its configuration file, however, determines which programs (including
and especially the window manager) are run when X starts up. <tt
class="COMMAND">xinit</tt> first checks your home directory for a <tt
class="FILENAME">.xinitrc</tt> file. If the file is found, it gets run; otherwise, <tt
class="FILENAME">/var/X11R6/lib/xinit/xinitrc</tt> (the systemwide default) is used.
Here's a simple <tt class="FILENAME">xinitrc</tt> file:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
#!/bin/sh
# $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
sysmodmap=/usr/X11R6/lib/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f $userresources ]; then
xrdb -merge $userresources
fi
if [ -f $usermodmap ]; then
xmodmap $usermodmap
fi
# start some nice programs
twm &#38;
xclock -geometry 50x50-1+1 &#38;
xterm -geometry 80x50+494+51 &#38;
xterm -geometry 80x20+494-0 &#38;
exec xterm -geometry 80x66+0+0 -name login
</pre>
</td>
</tr>
</table>
<p>All of those &#8220;if&#8221; blocks are there to merge in various configuration
settings from other files. The interesting part of the file is toward the end, where
various programs are run. This X session will begin with the <tt
class="COMMAND">twm</tt>(1) window manager, a clock, and three terminals. Note the <tt
class="COMMAND">exec</tt> before the last <tt class="COMMAND">xterm</tt>. What that does
is replace the currently running shell (the one that's executing this <tt
class="FILENAME">xinitrc</tt> script) with that <tt class="COMMAND">xterm</tt>(1)
command. When the user quits that <tt class="COMMAND">xterm</tt>, the X session will
end.</p>
<p>To customize your X startup, copy the default <tt
class="FILENAME">/var/X11R6/lib/xinit/xinitrc</tt> to <tt
class="FILENAME">~/.xinitrc</tt> and edit it, replacing those program lines with whatever
you like. The end of mine is simply:</p>
<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="PROGRAMLISTING">
# Start the window manager:
exec startkde
</pre>
</td>
</tr>
</table>
<p>Note that there are several <tt class="FILENAME">xinitrc.*</tt> files in <tt
class="FILENAME">/var/X11R6/lib/xinit</tt> that correspond to various window managers and
GUIs. You can use any of those, if you like.</p>
</div>
<div class="NAVFOOTER">
<hr align="LEFT" width="100%" />
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href="x-window-system-xorgsetup.html"
accesskey="P">Prev</a></td>
<td width="34%" align="center" valign="top"><a href="index.html"
accesskey="H">Home</a></td>
<td width="33%" align="right" valign="top"><a href="x-window-system-xwmconfig.html"
accesskey="N">Next</a></td>
</tr>
<tr>
<td width="33%" align="left" valign="top"><tt class="COMMAND">xorgsetup</tt></td>
<td width="34%" align="center" valign="top"><a href="x-window-system.html"
accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top"><tt class="COMMAND">xwmconfig</tt></td>
</tr>
</table>
</div>
</body>
</html>