Score:0

Detect Windows X server display number from Linux (client of X)

us flag

Our team often connect to a Windows server through remote desktop (RDP). Inside RDP, we use Putty (a terminal emulator) to connect to a Linux server. Sometimes we launch X-Win32 (an X server for Windows) in RDP and run an X application on Linux to show the GUI to Windows. If only one person does this, he can export DISPLAY=[Windows server]:0 in the Linux Putty window and run the X app. If another person does this, most likely he needs to set DISPLAY to [Windows server]:1, ... The number after the colon is the X display number. We can see it by moving mouse over the X-Win32 icon at the lower right corner of RDP. But I wonder if there's a way to detect that number from Linux.

We probably can manually set an environment variable in Putty (Connection->Data->Environment variables) before we connect to Linux and once connected, the bash shell will have the variable set. Or we can run Process Explorer on the Windows server and check the environment variable DISPLAY in process ime.exe (a process spawned by X-Win32). But these are even more complicated than telling our team members to move mouse over X-Win32 icon to get the display number. Is there an easier way or a way we can automate? If none, that's fine. Thank you!

Davidw avatar
in flag
Why run the double hop? Also, there is an RDP client for Linux.
yong321 avatar
us flag
I didn't know RDP client for Linux. Thanks for that info. The reason we use the Windows server is that it's guaranteed to be very stable. I personally use tmux (or screen on older Linux) to prevent network disconnect so I always launch X app from Linux that is accessed from my laptop. But my coworkers prefer to use that Windows server to connect to Linux to get a stable connection. (Update: Actually, X app will abort even if it's launched inside tmux. So occasionally I use that Windows server too if the X app will run for a while and my home network is not stable.)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.