1

My computer has only one display. Does it correspond to $DISPLAY :0?

Can an application run on an arbitrary display number, even if I don't see it?

$ DISPLAY=:40 firefox

Can a X server run on an arbitrary display number? Will the kernel implicitly create a virtual display?

$ xpra start :7

Thanks.

10
  • See unix.stackexchange.com/questions/503870/…. There's no need to mention the kernel Mar 12, 2019 at 23:20
  • this question is a mess; fix at least the display specs :0, :40 (both starting with a colon). The kernel does not create any virtual display. You can create a virtual display with Xvfb :1337, then run firefox on it with DISPLAY=:1337 firefox.
    – user313992
    Mar 13, 2019 at 0:56
  • @mosvy Thanks. Is a display exactly a socket (and a screen id)? What does "a virtual display " mean?
    – Tim
    Mar 13, 2019 at 1:23
  • 1
    No, the same Xserver (aka display) can listen on multiple sockets (by default on linux it's listening on two unix sockets, one file-based and another one abstract; -listen tcp will let it also listen on a tcp socket). Also, a xserver/display can have multiple "screens", though nowadays multiple monitors are managed as part of a single "screen". An xserver can use a hardware framebuffer, a dummy framebuffer (Xvfb) or a window on another xserver (Xephyr). The latter two are examples of "virtual" xserver/displays.
    – user313992
    Mar 13, 2019 at 1:34
  • 2
    Do not confuse the actual display (your monitor(s)), the X11 server ("display"), and the way it's accessed via sockets or other means: DISPLAY=:0 and DISPLAY=localhost:10 as forwarded via ssh refer to the same display/xserver, the same video card, and the same monitor.
    – user313992
    Mar 13, 2019 at 1:39

1 Answer 1

5

You can specify an arbitrary display, but you won’t get far if there’s no corresponding X server. The display number is specified when the X server is started, by whatever starts the X server — typically your display manager, or yourself in your Xpra example. It’s :0 by default (see the Xserver manpage). It can be chosen arbitrarily, but the X server won’t start if the corresponding resources aren’t available (port 6000 + the display number if it’s configured to listen on TCP, /tmp/.X11-unix/X followed by the display number if it’s configured to listen on a Unix domain socket, etc.). The kernel isn’t involved.

8
  • Thanks. "the corresponding resources aren’t available (port 6000 + the display number if it’s configured to listen on TCP)". Is the corresponding resources only TCP port? Is it by default configured to listen on TCP?
    – Tim
    Mar 12, 2019 at 18:47
  • 1
    See my update. The defaults depend on your system; typically X listens on TCP and domain sockets, but many setups now disable TCP (with the -nolisten tcp option). Mar 12, 2019 at 19:09
  • Thanks. Does "staring a X server at display n" means exactly starting a X server which listens at a port 6000+n (Unix or TCP domain socket)? No more no less?
    – Tim
    Mar 12, 2019 at 22:10
  • Notice that there's no port number for Unix domain sockets Mar 12, 2019 at 23:21
  • 1
    @Tim a) the current X11 servers do not listen on tcp by default (you'll have to force them to with -listen tcp b) unix sockets have no ports. If you start an X11 server with Xorg :2000000000, it will create and listen on an unix socket in /tmp/.X11-unix/X2000000000 (and also on an abstract socket with the same name in Linux). The limit for a display number is MAX_INT when listening on a Unix socket, and 65535-6000=59535 when listening on tcp.
    – user313992
    Mar 13, 2019 at 0:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .