3

I would like to run a "naked" X server (using a framebuffer for output) on the Pi.

However, startx will also start LXDE, just as startlxde and startlxde-pi do, and I cannot find a way to get around that. (LXDE does work fine with the framebuffer and all. It's just that I don't need+want a full DE for an embedded, single application system.)

What's the right way to launch an X server without LXDE on the Pi?

(Linux raspberrypi 4.1.13+ #826 PREEMPT Fri Nov 13 20:13:22 GMT 2015 armv6l GNU/Linux)

Steve Robillard
  • 34,988
  • 18
  • 106
  • 110
JimmyB
  • 141
  • 1
  • 7

1 Answers1

2

xinit(1) is the script/command you are looking for!

Literal excerpt from the manpage:

EXAMPLES
Below are several examples of how command line arguments in xinit are used.

  • xinit This will start up a server named X and run the user's .xinitrc, if it exists, or else start an xterm.
  • xinit -- /usr/bin/Xvnc :1 This is how one could start a specific type of server on an alternate display.
  • xinit -geometry =80x65+10+10 -fn 8x13 -j -fg white -bg navy This will start up a server named X, and will append the given arguments to the default xterm command. It will ignore .xinitrc.
  • xinit -e widgets -- ./Xorg -l -c This will use the command .Xorg -l -c to start the server and will append the arguments -e widgets to the default xterm command.
  • xinit /usr/ucb/rsh fasthost cpupig -display ws:1 -- :1 -a 2 -t 5 This will start a server named X on display 1 with the arguments -a 2 -t 5. It will then start a remote shell on the machine fasthost in which it will run the command cpupig, telling it to display back on the local workstation.

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.

    xrdb -load $HOME/.Xresources
    xsetroot -solid gray &
    xclock -g 50x50-0+0 -bw 0 &
    xload -g 50x50-50+0 -bw 0 &
    xterm -g 80x24+0+0 &
    xterm -g 80x24+0-0 &
    twm

Sites that want to create a common startup environment could simply create a default .xinitrc that references a site-wide startup file:

#!/bin/sh
. /etc/X11/xinit/site.xinitrc

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 inter‐face for novice users:

#!/bin/sh
xinit /etc/X11/xinit/site.xinitrc -- /usr/bin/X -br
SlySven
  • 3,631
  • 1
  • 20
  • 46