Xvfb - start or attach a window manager to xvfb

3.3k views Asked by At

For testing purpose, I used Xvfb. Today, I want to do some test with wmctrl commmand. I do some test in python like this :

    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()

In this test, wmctrl says :

    Cannot get client list properties. 
(_NET_CLIENT_LIST or _WIN_CLIENT_LIST)

I think, it's normal because I haven't any window manager attach to my Xvfb.

How to start a windows manager (Enlighenment should be good for my case) to manage only Xvfb ?

1

There are 1 answers

0
Emmanuel DUMAS On

After some days of works, I can answer myself. Solution is easy as possible : just start windows manager with variable DISPLAY set. So in my python script, I just do :

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()