5

I want to create a VNC session to expose a single application that I start on a virtual display. And I want to do it with x11vnc because after that I can expose it through noVNC.

The problem is that x11vnc allows me to create a virtual display:

x11vnc -create

... or to expose a single window of an already launched application

x11vnc -id 0x200002

but I did not find any option to start a new application in a new virtual display (like xstartup for vncserver).

Michael Dussere
  • 498
  • 7
  • 25

4 Answers4

6

So far the only solution I found is to do all the procedure manually

# create a virtual display on the compute node
Xvnc :33 &

# launch the application on this virtual display
export DISPLAY=:33
glxgears &

# find out its window id
xwininfo -root -children

# -> xwininfo: Window id: 0xdc (the root window) (has no name)
#
#  Root window id: 0xdc (the root window) (has no name)
#  Parent window id: 0x0 (none)
#     1 child:
#     0x200002 "glxgears": ()  300x300+0+0  +0+0

# start the vnc server with this specifix xid
x11vnc -id 0x200002 &

It works but it is a bit complex and I still have to write a small command to get the xid automatically.

Michael Dussere
  • 498
  • 7
  • 25
1

I don't have enough "reputation" to write a comment, so I have to write my own answer despite this being just a modification to Michael's answer, which TBH I have yet to test. I came up with a quick hack to get the window ID since I won't be able to input it manually. Try this to find out the Window ID:

window_id=$(xwininfo -root -tree | grep glxgears | tail -n1 | sed "s/^[ \t]*//" | cut -d ' ' -f1)

So you're getting the tree, filtering for the program you're looking for, getting the last option, removing trailing whitespace, then getting only the first column, and saving it. Then you can run...

x11vnc -id $window_id &

...to the same effect as Michael's answer. Hopefully. Like I said, it's a hack.

1

Nice one for sharing windows at the office !

echo "Select Window...";x11vnc -id $(xwininfo|grep -oP '(?<=id: ).*(?= ")') -viewonly -forever

Or a shorter one:

x11vnc -id pick -viewonly -forever
bougui
  • 3,507
  • 4
  • 22
  • 27
Patrik
  • 11
  • 1
0

x11vnc supports sharing a window based on it’s id. Here you can take simulator as window and share it.

Below is steps:

  • Run xwininfo from a terminal. Click on the window you want to share. xwininfo will print out the window id.
  • Run `x11vnc -id win_id take win_id from above steps.

Example command:

 x11vnc -id 0x2800005
Haris
  • 13,645
  • 12
  • 90
  • 121