Identifying the real display server

Thiago Macieira thiago at kde.org
Mon Apr 13 13:49:07 PDT 2015


On Monday 13 April 2015 19:33:23 Mattias Andrée wrote:
> > If we're going to do that, why not put the full
> > identifiers in the variable? Then we wouldn't have to
> > look up another environment variable for the details.
> 
> Are you asking why we should have PREFERRED_DISPLAY=x11
> rather than PREFERRED_DISPLAY=DISPLAY or are you asking
> why we should have PREFERRED_DISPLAY=x11 rather than
> PREFERRED_DISPLAY=x11=:0?

The latter.

> If the latter:
> 
> If we do not to it this way, it makes the example above,
> and similar things, more complex.
> I think that WAYLAND_DISPLAY &c should _not_ be removed.
> So it would be redundant, and doing a second look up is
> cheap. And a program that only supports Wayland would
> have to parse PREFERRED_DISPLAY.

That's until someone figures out another display server besides the ones that 
already exist. This avoids having 4+ environment variables set when one could 
do it just fine.

  # pseudo-code, I don't know Python
  for url in os.environ['PREFERRED_DISPLAY'].split():
    if isDisplaySupported(url.scheme()):
       initDisplay(url.path())
  else:
    croak()

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358



More information about the xdg mailing list