Commit 42fdcbfc1be7bd1c228a535cb432c682ac0f80d9 Parent: 897450cfa10532a7b6b55d56368a85ec5b2e9fbc Author: mcol <mcol@posteo.net> Date: 2020-06-02 20:41:39 +0100 Committer: mcol <mcol@posteo.net> Committed: 2020-06-02 20:41:39 +0100 xresources: get DISPLAY if not provided
qtools/xresources/xresources.py Modified
@@ -3,19 +3,21 @@ """ +import os + import xcffib import xcffib.xproto from libqtile.log_utils import logger -def get(DISPLAY, defaults=None): +def get(DISPLAY=None, defaults=None): """ Get the X resources in an X servers resource manager. Parameters ========== - DISPLAY : str - DISPLAY name to query. + DISPLAY : str (optional) + DISPLAY name to query. This will be taken from the environment if not specified. defaults : dict (optional) Default values to act as a fallback for missing values or in the event of a @@ -31,6 +33,9 @@ """ resources = defaults if defaults else {} + if DISPLAY is None: + DISPLAY = os.environ.get("DISPLAY") + try: conn = xcffib.connect(display=DISPLAY) except xcffib.ConnectionException as e: