61

What does the :0.0 actually mean? I know that :0 is the first X server that is started on a local machine, :1 the second, etc. But what is that .0 part after :0? Do other combinations exist? (e.g. :0.0-something)

Background: I'm trying to improve the initscript of bumblebee which currently assumes that :0 is the active display. That is not the case if I switch users. So I wanted to validate the $DISPLAY variable before passing it to vglclient.

Lekensteyn
  • 20,830

1 Answers1

64

The format of the display variable is [host]:<display>[.screen].

host refers to a network host name, and if absent means to connect to the local machine via a unix domain socket.

Each host can have multiple displays, and each display can have multiple screens. Screens aren't used much anymore, with xinerama and now xrandr combining multiple screens into a single logical screen.

camh
  • 39,069
  • 4
    Thanks, I just found the right manual page too, Xserver(1) referred to the DISPLAY NAMES section of X(7). Refer to that manual page for details. – Lekensteyn Jul 17 '11 at 09:28
  • 5
    And how would I get a list of available displays for a certain host? Ideally within an ssh session where i'm logged in at the host from a client PC. – con-f-use Aug 14 '12 at 11:59
  • @con-f-use That is a new question; you should create a new question rather than a comment. – depquid Apr 17 '13 at 14:58
  • 3
    The display part is also used on X over SSH. Every new SSH connection with X forwarding enabled is assigned a different display, because these screens correspond internally to a TCP port number offset, e.g. DISPLAY=localhost:10.0 will cause the client to direct graphical output to host localhost port 6010. This is required for SSH X forwarding, because if you have multiple connections to the same computer, your program must send different outputs to different ports so that the SSH server can forward the X output to the proper destination. – RAKK Apr 01 '15 at 19:02
  • what port should be open if all the ports are block outbound from the server. – Raza Jul 27 '15 at 22:19
  • 4
    @Raza: The TCP port numbers to open are 6000 + display_number. For display host:0.0 that is port 6000. For display host:10.0 that is port 6010. Note that SSH X11 forwarding is done over port 22 and not X11 ports. – camh Jul 28 '15 at 04:34
  • On my mac, DISPLAY=:0 xterm works, but DISPLAY=localhost:0 xterm does not work. How come? What's the default unix domain socket? – Claudiu Jun 15 '16 at 03:56
  • 1
    @Claudiu: DISPLAY=:0 will use a unix domain socket, DISPLAY=localhost:0 will use a internet domain socket (IP). It is likely your X server is not listening on a TCP/IP end point. I don't know the default unix domain socket. – camh Jun 15 '16 at 09:26