From 1d1138ca31e80ebcdde205a6078fec738d30c8f2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 20 May 2017 00:26:26 +0530 Subject: [PATCH] Be a little more stringent with Xft parsing --- kitty/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kitty/utils.py b/kitty/utils.py index 68fb8a411..59d53d0c4 100644 --- a/kitty/utils.py +++ b/kitty/utils.py @@ -78,9 +78,10 @@ def x11_dpi_native(): raise RuntimeError('Could not connect to the X server') try: db = XResourceManagerString(display).decode('utf-8') + q = 'Xft.dpi:\t' for line in db.splitlines(): - if line.startswith('Xft.dpi:'): - return float(line.split()[1]) + if line.startswith(q): + return float(line[len(q):]) finally: XCloseDisplay(display) raise RuntimeError('Failed to get dpi resource')