【问题标题】:Xvfb - start or attach a window manager to xvfbXvfb - 启动或附加一个窗口管理器到 xvfb
【发布时间】:2016-12-23 09:17:20
【问题描述】:

出于测试目的,我使用了 Xvfb。 今天,我想用 wmctrl 命令做一些测试。我在 python 中做了一些这样的测试:

    display = ":99"
    pXvfb = subprocess.Popen(["Xvfb", display, "-screen", "0", "1024x768x24"])

    # wait that xvfb is up
    time.sleep(1)

    os.environ["DISPLAY"] = display

    p = subprocess.Popen( ["wmctrl", "-l" ] )
    p.wait()


    pXvfb.terminate()

在这个测试中,wmctrl 说:

    Cannot get client list properties. 
(_NET_CLIENT_LIST or _WIN_CLIENT_LIST)

我认为这很正常,因为我的 Xvfb 上没有附加任何窗口管理器。

如何启动 Windows 管理器 (Enlighenment should be good for my case) 来只管理 Xvfb ?

【问题讨论】:

    标签: xvfb window-managers xserver


    【解决方案1】:

    经过几天的工作,我可以回答自己了。解决方案尽可能简单:只需启动带有变量 DISPLAY 设置的 Windows 管理器。所以在我的 python 脚本中,我只是这样做:

    display = ":99"
    pXvfb = subprocess.Popen(["Xvfb", display, "-screen", "0", "1024x768x24"])
    
    # wait that xvfb is up
    time.sleep(1)
    
    os.environ["DISPLAY"] = display
    
    # start windows manager
    pWM = subprocess.Popen( ["/usr/bin/enlightenment_start", ]  )
    
    p = subprocess.Popen( ["wmctrl", "-l" ] )
    p.wait()
    
    
    pXvfb.terminate()
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-14
      • 1970-01-01
      • 2017-09-24
      • 1970-01-01
      相关资源
      最近更新 更多