如何使用 x11vnc 建立单窗口 vnc 会话?

Mic*_*ere 5 vnc

我想创建一个 VNC 会话来公开我在虚拟显示器上启动的单个应用程序。我想用 x11vnc 来做,因为之后我可以通过 noVNC 公开它。

问题是 x11vnc 允许我创建虚拟显示器:

x11vnc -create
Run Code Online (Sandbox Code Playgroud)

...或公开已启动应用程序的单个窗口

x11vnc -id 0x200002
Run Code Online (Sandbox Code Playgroud)

但我没有找到任何在新的虚拟显示器中启动新应用程序的选项(例如 vncserver 的 xstartup)。

Mic*_*ere 6

到目前为止,我找到的唯一解决方案是手动完成所有过程

# 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 &
Run Code Online (Sandbox Code Playgroud)

它可以工作,但有点复杂,我仍然需要编写一个小命令来自动获取 xid。