mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-08-24 19:35:24 +02:00
theme: get scale factor from Xft.dpi
And uses xrdb as it is easier to do this way.
This commit is contained in:
parent
e0ceb40259
commit
06e6c28ac7
1 changed files with 6 additions and 6 deletions
12
rc/theme.lua
12
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue