theme: get scale factor from Xft.dpi

And uses xrdb as it is easier to do this way.
This commit is contained in:
Vincent Bernat 2015-07-23 13:30:26 +02:00
parent e0ceb40259
commit 06e6c28ac7

View file

@ -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