summaryrefslogtreecommitdiff
path: root/slackbook/html/x-window-system-xinitrc.html
blob: 968b4c139f1c510c3436f544f0854b956bb2acda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<!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>