From 06e6c28ac74633515dbc7a372ce4b5db998350d3 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Thu, 23 Jul 2015 13:30:26 +0200 Subject: [PATCH] theme: get scale factor from Xft.dpi And uses xrdb as it is easier to do this way. --- rc/theme.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rc/theme.lua b/rc/theme.lua index fa28809..cceeebe 100644 --- a/rc/theme.lua +++ b/rc/theme.lua @@ -4,16 +4,16 @@ local na = awful.util.color_strip_alpha local icons = awful.util.getdir("config") .. "/icons" local function scale() - local xdpyinfo = io.popen("xdpyinfo") - if xdpyinfo then - for line in xdpyinfo:lines() do - output = line:match("^%s*resolution:%s+(%d+)x%d+ dots per inch$") + local xrdb = io.popen("xrdb -query") + if xrdb then + for line in xrdb:lines() do + output = line:match("^Xft.dpi:\t(%d+)$") if output then - xdpyinfo:close() + xrdb:close() return tonumber(output)/96 end end - xdpyinfo:close() + xrdb:close() end return 1 end