Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Wha-?

Only on the local machine?

I beg of you - don't do that. First off, determining that the X server is running on the local machine is a hard problem. Secondly, why limit me at all? If I set my DISPLAY to "othermachine:8", why should that bother you? The X protocol handles this just fine!

Proof that it's a hard problem: one machine at work doesn't have X loaded locally at all. But I use DISPLAYs of machine:2, machine:7, and localhost:10.0 (and others, but that's all I've got at this moment in time). None of them are "local" per se. The first two are VNC servers (different users). The X server is really running on that machine, but they're never visible on the monitor attached to the machine. The first one is only visible on my home computer (3000km away). The second is one I share with another coworker (we can both be on the phone and on VNC seeing the same screen). The third is my SSH tunnel which means the X server is actually physically at home, even though it says "localhost". (Which is faster, the VNC server or the SSH tunnel, depends on what I'm doing, so I have both, and use each when appropriate.) "machine:0" doesn't exist on this machine.

Even using ":0" as the local display can be problematic since I can put VNC server on that port as long as the local X server isn't loaded. Or I can have two local X servers on two different monitors - thus one of them could be :1 (or :0.1, depending). Detecting this is a waste of time. If the user gives you a DISPLAY, use it. If they don't, don't. That's as smart as I would ever want my software to be. Anything else, and you're trying to outsmart me, when I'm merely using the X protocol to the fullest advantage I can. Remember: the user may know more about X than you do. Let them use that knowledge, and let your APIs deal with that.


In reply to Re^8: How to detect X? by Tanktalus
in thread How to detect X? by blazar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others taking refuge in the Monastery: (1)
    As of 2024-09-07 15:40 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?
      erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.