Xinitrc (Italiano)

From ArchWiki
Revision as of 01:26, 8 September 2010 by Morbin (Talk | contribs) (Created page with "Category:Desktop environments (Italiano) Category:Boot process (Italiano) Category:X Server (Italiano) Category:HOWTOs (Italiano) {{Translateme}} {{i18n|Xinitrc}}...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Xinitrc (Italiano)#)

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end

The xinit program is used to start the X Window System server and a first client program on systems that cannot start X directly from Template:Filename or in environments that use multiple window systems. The Template:Filename file is therefore a simple way to start X usually in conjunction with [[Start X at boot#/etc/inittab|running the startx script directly from Template:Filename]].

How it works

The Template:Filename file is really just one more shell script to run. It can be used to start various applications you want to associate with starting X, e.g. the X screensaver, and to set global environment variables, like MOZ_PLUGIN_PATH. Its foremost use however, is as a replacement for a display manager when on a single-user machine.

When a display manager is not used, it is important to keep in mind that the life of your X session starts and ends with the Template:Filename script. What this means is that once the script finishes, X quits regardless of whether you still have running programs (including your window manager). It is therefore important that the window manager quitting and X quitting should coincide. This is easily achieved by running the window manager as the last program in the Template:Filename script, e.g.:


Notice that applications such as Template:Codeline, Template:Codeline, Template:Codeline, and Template:Codeline are run in the background (Template:Codeline appendage). Otherwise, the script would halt and wait for the programs and daemons to quit before continuing to export the variable line and executing Template:Codeline.

The Template:Codeline line starting an Openbox session however, is not backgrounded. This ensures that the script will not quit until Openbox does. If you run the Template:Codeline script manually, ending the script will terminate X and leave you with whatever virtual consoles your Template:Filename has started.

If running it from Template:Filename and have set the line to 'respawn' (rather than 'once'), Template:Filename will be run again. In this way X can be restarted without having to restart the computer.

A standard .xinitrc

Using this template you can simply uncomment your choice, e.g. GNOME:


Note: Prepending Template:Codeline is not necessary as long as additional desktop/window managers are commented out as they are in the above example.
Note: When X is started manually via Template:Codeline, the tty is automatically switched to the closest one not running agetty/mingetty. Programs like xscreensaver will only lock this last tty (i.e. the current X session), but not the one which called Template:Codeline. Therefore, someone can just use CTRL-ALT-Fn to switch tty and kill X with CTRL-C, and gain access to the user data. Please consider locking the tty after executing Template:Codeline. More information can be found at [1].

Multiple DE options

On the command line

If you have a working Template:Filename, but just want to try other WM/DE you can run Template:Codeline from command line like this

xinit /full/path/to/window-manager

The full path is required. Optionally you can pass options to X server after '--', e.g.

xinit /usr/bin/enlightenment -- -br +bs -dpi 96

You can use the following example Template:Filename to start a particular window manager with an argument:


Using this Template:Filename you can start Fluxbox with the command Template:Codeline or start scrotwm with the command Template:Codeline.

At startup

You can also have a choice of window managers and desktop environments at startup, using just Template:Filename and GRUB and no display manager. The idea is to take advantage of the fact that Arch doesn't make any particular use of the runlevel system. The following Template:Filename tests for the current runlevel and will start Openbox and GNOME on runlevels 5 and 4 respectively:

rl=$(runlevel | grep -o [0-6])

case $rl in
	4) exec gnome-session;;
	5) exec openbox-session;;

Choosing between different runlevels is simply a matter of cloning a GRUB entry and adding the desired runlevel to the kernel arguments. Inserting the runlevel at the end of the 'kernel' line indicates that the Template:Filename default of runlevel 5 should be overridden and replaced with the desired runlevel, 4 in this instance:

title  Arch Linux GNOME
root   (hd0,2)
kernel /boot/vmlinuz26 root=/dev/sda1 ro 4
initrd /boot/kernel26.img

Finally, you will need to ensure that the Template:Filename file is actually run at the chosen runlevel. Using the tip from Start X at boot#/etc/inittab, you can edit the Template:Filename to simply run Template:Codeline on the desired runlevel which will in turn use your Template:Filename script:

x:45:once:/bin/su PREFERED_USER -l -c "/bin/bash --login -c startx >/dev/null 2>&1"

Notice that "45" means that this will happen on both runlevels 4 and 5. The final differentiation between 4 and 5 will then come in Template:Filename as described above. This is preferable to attempt differentiating in the Template:Filename file as we stick pretty close to using the various configuration files as they were intended.


Various Gnome(*) applications expect policykit to be active, and will produce errors if absent. Login managers such as Gdm will start policykit automatically, but when using .xinitrc only, you should make it run like so:

exec ck-launch-session gnome-session

(*) I specifically recall Rhythmbox/Gstreamer, but there are probably many more examples. <Expand and improve this section plz!>

External links