mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-30 13:24:21 +02:00
theme: adapt to "hidpi" screens
We use a scale factor. We are expected to have something sensible set for DPI.
This commit is contained in:
parent
52b70e4046
commit
b302b70787
2 changed files with 21 additions and 5 deletions
22
rc/theme.lua
22
rc/theme.lua
|
@ -3,11 +3,27 @@
|
|||
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$")
|
||||
if output then
|
||||
xdpyinfo:close()
|
||||
return tonumber(output)/96
|
||||
end
|
||||
end
|
||||
xdpyinfo:close()
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
theme = {}
|
||||
theme.scale = scale()
|
||||
theme.icons = icons
|
||||
theme.wallpaper_cmd = { "/bin/true" }
|
||||
theme.font = "Terminus 8"
|
||||
theme.tasklist_font = "DejaVu Sans 8"
|
||||
theme.font = "Terminus " .. 8 * theme.scale
|
||||
theme.tasklist_font = "DejaVu Sans " .. 8 * theme.scale
|
||||
|
||||
theme.bg_normal = "#22222299"
|
||||
theme.bg_focus = "#d8d8d8bb"
|
||||
|
@ -44,7 +60,7 @@ end
|
|||
-- Naughty
|
||||
naughty.config.presets.normal.bg = theme.bg_widget
|
||||
for _,preset in pairs({"normal", "low", "critical"}) do
|
||||
naughty.config.presets[preset].font = "DejaVu Sans 10"
|
||||
naughty.config.presets[preset].font = "DejaVu Sans " .. 10 * theme.scale
|
||||
end
|
||||
|
||||
return theme
|
||||
|
|
|
@ -130,7 +130,7 @@ local netdownicon = widget({ type = "imagebox" })
|
|||
netdownicon.image = image(beautiful.icons .. "/widgets/down.png")
|
||||
|
||||
local netgraph = awful.widget.graph()
|
||||
netgraph:set_width(80):set_height(16)
|
||||
netgraph:set_width(80):set_height(16 * theme.scale)
|
||||
netgraph:set_stack(true):set_scale(true)
|
||||
netgraph:set_border_color(beautiful.fg_widget_border)
|
||||
netgraph:set_stack_colors({ "#EF8171", "#cfefb3" })
|
||||
|
@ -263,7 +263,7 @@ for s = 1, screen.count() do
|
|||
fg = beautiful.fg_normal,
|
||||
bg = beautiful.bg_widget,
|
||||
position = "top",
|
||||
height = 16,
|
||||
height = 16 * theme.scale,
|
||||
})
|
||||
-- Add widgets to the wibox
|
||||
local on = function(n, what)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue