...
This commit is contained in:
parent
1276bd6f5d
commit
b5c4fbb42b
1 changed files with 7 additions and 3 deletions
|
|
@ -86,7 +86,7 @@ def cdef(name, restype, *argtypes):
|
|||
|
||||
def parse_xrdb(raw):
|
||||
q = 'Xft.dpi:\t'
|
||||
for line in raw.decode('utf-8').splitlines():
|
||||
for line in raw.decode('utf-8', 'replace').splitlines():
|
||||
if line.startswith(q):
|
||||
return float(line[len(q):])
|
||||
|
||||
|
|
@ -94,8 +94,12 @@ def parse_xrdb(raw):
|
|||
def x11_dpi():
|
||||
XResourceManagerString = load_libx11()
|
||||
display = x11_display()
|
||||
raw = XResourceManagerString(display)
|
||||
return parse_xrdb(raw)
|
||||
if display:
|
||||
try:
|
||||
raw = XResourceManagerString(display)
|
||||
return parse_xrdb(raw)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def get_logical_dpi():
|
||||
|
|
|
|||
Loading…
Reference in a new issue