local/remote how to detect?

Josh Triplett josh at freedesktop.org
Mon Jul 2 23:22:32 PDT 2007


Bert Wesarg wrote:
> 
> Carsten Haitzler (The Rasterman) wrote:
>> On Mon, 02 Jul 2007 23:15:24 +0200 Bert Wesarg <wesarg at informatik.uni-halle.de>
>> babbled:
>>
>>> Tiago Vignatti wrote:
>>>> Bert Wesarg escreveu:
>>>>> Hello All,
>>>>>
>>>>> [ Maybe a FAQ ]
>>>>>
>>>>> is it possible to reliable detect if me (the X client) is remote or local
>>>>> to the X server?
>>>> Maybe the 'xlsclients' tool. The first row of the output will tell which 
>>>> machine the client is connected.
>>> Thanks, indeed a nice tool. unfortunelatly the client i'm interested (a
>>> motif one) is not even listed when all is running local (and yes I used
>>> option -a and -l)! all other things like xmms, gkrellm are listed.
>> all xlsclients does it walk the window tree and look at window properties for
>> title, name/class etc.
>>
>> as i suggested before. try create an xshmimage - this will only succeed if you
>> are local. tonnes of sample code out there on how to do this (its more than 1
>> step).
> Yeah I will look into this, but your first response sounds a little bit
> like a joke.

No joke; raster's solution should do what you want.

> I just see that the mplayer checks for a display number < 10 to decide
> whether the display is local or remote. how reliable is this? is this
> somewhere documented?

Not reliable at all.  SSH normally creates remote X displays starting at 10;
this mplayer hack will handle that one case, but not any other cases of remote
displays, and it can misclassify local displays as remote if they have a high
number (which can legitimately happen).

- Josh Triplett

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20070702/741253c2/attachment.pgp>


More information about the xorg mailing list