Skip to content

How to use existing display / set display number? #97

@plonknimbuzz

Description

@plonknimbuzz

Hi, there

i have this service:

#/etc/systemd/system/xvfb.service

[Unit]
Description=X virtual framebuffer

[Service]
Type=simple
User=root

ExecStart=/usr/bin/Xvfb :99 -ac

[Install]
WantedBy=multi-user.target
ps -ef|grep Xvfb
root     15802     1  0 Jul28 ?        00:00:00 /usr/bin/Xvfb :99 -ac

as u can see that i used :99 as display number
but i failed to set it using this script

from pyvirtualdisplay import Display
import os
print(os.environ.get("DISPLAY"))
os.environ["DISPLAY"] = ":99"
print(os.environ.get("DISPLAY"))
with Display() as disp:
    # display is active
    print(disp.is_alive()) # True
    print(os.environ.get("DISPLAY"))
# display is stopped
print(disp.is_alive())

result

None
:99
True
:0 ==> failed
False

my question is: how to set display number?
because i want to use display that created from outside of this library

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions