Be a little more stringent with Xft parsing
This commit is contained in:
parent
357a415386
commit
1d1138ca31
@ -78,9 +78,10 @@ def x11_dpi_native():
|
|||||||
raise RuntimeError('Could not connect to the X server')
|
raise RuntimeError('Could not connect to the X server')
|
||||||
try:
|
try:
|
||||||
db = XResourceManagerString(display).decode('utf-8')
|
db = XResourceManagerString(display).decode('utf-8')
|
||||||
|
q = 'Xft.dpi:\t'
|
||||||
for line in db.splitlines():
|
for line in db.splitlines():
|
||||||
if line.startswith('Xft.dpi:'):
|
if line.startswith(q):
|
||||||
return float(line.split()[1])
|
return float(line[len(q):])
|
||||||
finally:
|
finally:
|
||||||
XCloseDisplay(display)
|
XCloseDisplay(display)
|
||||||
raise RuntimeError('Failed to get dpi resource')
|
raise RuntimeError('Failed to get dpi resource')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user