From 684a432de2ec55136a786486d859ec62ac7279f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20VANNI=C3=88RE?= Date: Sat, 2 Mar 2019 18:05:33 +0000 Subject: [PATCH] HiDPI compatibility fixes --- rc.lua.template | 13 ++++--- themes/blackburn/theme.lua | 11 +++--- themes/copland/theme.lua | 29 +++++++------- themes/dremora/theme.lua | 11 +++--- themes/holo/theme.lua | 41 +++++++++---------- themes/multicolor/theme.lua | 9 +++-- themes/powerarrow-dark/theme.lua | 11 +++--- themes/powerarrow/binclock.lua | 5 ++- themes/powerarrow/theme.lua | 35 +++++++++-------- themes/rainbow/theme.lua | 15 +++---- themes/steamburn/theme.lua | 11 +++--- themes/vertex/theme.lua | 67 ++++++++++++++++---------------- 12 files changed, 135 insertions(+), 123 deletions(-) diff --git a/rc.lua.template b/rc.lua.template index 5b4b615..e0f8c59 100644 --- a/rc.lua.template +++ b/rc.lua.template @@ -21,6 +21,7 @@ local freedesktop = require("freedesktop") local hotkeys_popup = require("awful.hotkeys_popup").widget require("awful.hotkeys_popup.keys") local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility +local dpi = require("beautiful.xresources").apply_dpi -- }}} -- {{{ Error handling @@ -167,7 +168,7 @@ awful.util.tasklist_buttons = my_table.join( instance:hide() instance = nil else - instance = awful.menu.clients({theme = {width = 250}}) + instance = awful.menu.clients({theme = {width = dpi(250)}}) end end end), @@ -179,9 +180,9 @@ lain.layout.termfair.nmaster = 3 lain.layout.termfair.ncol = 1 lain.layout.termfair.center.nmaster = 3 lain.layout.termfair.center.ncol = 1 -lain.layout.cascade.tile.offset_x = 2 -lain.layout.cascade.tile.offset_y = 32 -lain.layout.cascade.tile.extra_padding = 5 +lain.layout.cascade.tile.offset_x = dpi(2) +lain.layout.cascade.tile.offset_y = dpi(32) +lain.layout.cascade.tile.extra_padding = dpi(5) lain.layout.cascade.tile.nmaster = 5 lain.layout.cascade.tile.ncol = 2 @@ -197,7 +198,7 @@ local myawesomemenu = { { "quit", function() awesome.quit() end } } awful.util.mymainmenu = freedesktop.menu.build({ - icon_size = beautiful.menu_height or 16, + icon_size = beautiful.menu_height or dpi(16), before = { { "Awesome", myawesomemenu, beautiful.awesome_icon }, -- other triads can be put here @@ -710,7 +711,7 @@ client.connect_signal("request::titlebars", function(c) end) ) - awful.titlebar(c, {size = 16}) : setup { + awful.titlebar(c, {size = dpi(16)}) : setup { { -- Left awful.titlebar.widget.iconwidget(c), buttons = buttons, diff --git a/themes/blackburn/theme.lua b/themes/blackburn/theme.lua index 3179653..a77eb7d 100644 --- a/themes/blackburn/theme.lua +++ b/themes/blackburn/theme.lua @@ -9,6 +9,7 @@ local gears = require("gears") local lain = require("lain") local awful = require("awful") local wibox = require("wibox") +local dpi = require("beautiful.xresources").apply_dpi local os = os local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility @@ -24,15 +25,15 @@ theme.bg_normal = "#060606" theme.bg_focus = "#060606" theme.fg_urgent = "#CC9393" theme.bg_urgent = "#2A1F1E" -theme.border_width = 1 +theme.border_width = dpi(1) theme.border_normal = "#0E0E0E" theme.border_focus = "#F79372" theme.taglist_fg_focus = "#F6784F" theme.taglist_bg_focus = "#060606" theme.tasklist_fg_focus = "#F6784F" theme.tasklist_bg_focus = "#060606" -theme.menu_height = 16 -theme.menu_width = 130 +theme.menu_height = dpi(16) +theme.menu_width = dpi(130) theme.menu_submenu_icon = theme.dir .. "/icons/submenu.png" theme.awesome_icon = theme.dir .."/icons/awesome.png" theme.taglist_squares_sel = theme.dir .. "/icons/square_sel.png" @@ -190,7 +191,7 @@ local first = wibox.widget.textbox(' ') local arrl_pre = separators.arrow_right("alpha", "#1A1A1A") local arrl_post = separators.arrow_right("#1A1A1A", "alpha") -local barheight = 18 +local barheight = dpi(18) local barcolor = gears.color({ type = "linear", from = { barheight, 0 }, @@ -239,7 +240,7 @@ function theme.at_screen_connect(s) s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons, { bg_normal = barcolor, bg_focus = barcolor }) -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s, height = 18, bg = barcolor }) + s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(18), bg = barcolor }) -- Add widgets to the wibox s.mywibox:setup { diff --git a/themes/copland/theme.lua b/themes/copland/theme.lua index d3ec23b..34d05ce 100644 --- a/themes/copland/theme.lua +++ b/themes/copland/theme.lua @@ -9,6 +9,7 @@ local gears = require("gears") local lain = require("lain") local awful = require("awful") local wibox = require("wibox") +local dpi = require("beautiful.xresources").apply_dpi local awesome, client, os = awesome, client, os local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility @@ -23,7 +24,7 @@ theme.bg_normal = "#111111" theme.bg_focus = "#111111" theme.fg_urgent = "#000000" theme.bg_urgent = "#FFFFFF" -theme.border_width = 1 +theme.border_width = dpi(1) theme.border_normal = "#141414" theme.border_focus = "#93B6FF" theme.taglist_fg_focus = "#FFFFFF" @@ -31,8 +32,8 @@ theme.taglist_bg_focus = "#111111" theme.taglist_bg_normal = "#111111" theme.titlebar_bg_normal = "#191919" theme.titlebar_bg_focus = "#262626" -theme.menu_height = 16 -theme.menu_width = 130 +theme.menu_height = dpi(16) +theme.menu_width = dpi(130) theme.tasklist_disable_icon = true theme.awesome_icon = theme.dir .."/icons/awesome.png" theme.menu_submenu_icon = theme.dir .. "/icons/submenu.png" @@ -155,14 +156,14 @@ theme.mpd = lain.widget.mpd({ -- Battery local baticon = wibox.widget.imagebox(theme.bat) local batbar = wibox.widget { - forced_height = 1, - forced_width = 59, + forced_height = dpi(1), + forced_width = dpi(59), color = theme.fg_normal, background_color = theme.bg_normal, margins = 1, paddings = 1, ticks = true, - ticks_size = 6, + ticks_size = dpi(6), widget = wibox.widget.progressbar, } local batupd = lain.widget.bat({ @@ -198,20 +199,20 @@ local batupd = lain.widget.bat({ end }) local batbg = wibox.container.background(batbar, "#474747", gears.shape.rectangle) -local batwidget = wibox.container.margin(batbg, 2, 7, 4, 4) +local batwidget = wibox.container.margin(batbg, dpi(2), dpi(7), dpi(4), dpi(4)) -- /home fs --[[ commented because it needs Gio/Glib >= 2.54 local fsicon = wibox.widget.imagebox(theme.disk) local fsbar = wibox.widget { - forced_height = 1, - forced_width = 59, + forced_height = dpi(1), + forced_width = dpi(59), color = theme.fg_normal, background_color = theme.bg_normal, margins = 1, paddings = 1, ticks = true, - ticks_size = 6, + ticks_size = dpi(6), widget = wibox.widget.progressbar, } theme.fs = lain.widget.fs { @@ -226,13 +227,13 @@ theme.fs = lain.widget.fs { end } local fsbg = wibox.container.background(fsbar, "#474747", gears.shape.rectangle) -local fswidget = wibox.container.margin(fsbg, 2, 7, 4, 4) +local fswidget = wibox.container.margin(fsbg, dpi(2), dpi(7), dpi(4), dpi(4)) --]] -- ALSA volume bar local volicon = wibox.widget.imagebox(theme.vol) theme.volume = lain.widget.alsabar { - width = 59, border_width = 0, ticks = true, ticks_size = 6, + width = dpi(59), border_width = 0, ticks = true, ticks_size = dpi(6), notification_preset = { font = theme.font }, --togglechannel = "IEC958,3", settings = function() @@ -275,7 +276,7 @@ theme.volume.bar:buttons(my_table.join ( end) )) local volumebg = wibox.container.background(theme.volume.bar, "#474747", gears.shape.rectangle) -local volumewidget = wibox.container.margin(volumebg, 2, 7, 4, 4) +local volumewidget = wibox.container.margin(volumebg, dpi(2), dpi(7), dpi(4), dpi(4)) -- Weather theme.weather = lain.widget.weather({ @@ -331,7 +332,7 @@ function theme.at_screen_connect(s) s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons) -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s, height = 18, bg = theme.bg_normal, fg = theme.fg_normal }) + s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(18), bg = theme.bg_normal, fg = theme.fg_normal }) -- Add widgets to the wibox s.mywibox:setup { diff --git a/themes/dremora/theme.lua b/themes/dremora/theme.lua index fee78fe..191f0ad 100644 --- a/themes/dremora/theme.lua +++ b/themes/dremora/theme.lua @@ -9,6 +9,7 @@ local gears = require("gears") local lain = require("lain") local awful = require("awful") local wibox = require("wibox") +local dpi = require("beautiful.xresources").apply_dpi local os = os local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility @@ -24,14 +25,14 @@ theme.bg_normal = "#121212" theme.bg_focus = "#121212" theme.fg_urgent = "#CC9393" theme.bg_urgent = "#2A1F1E" -theme.border_width = "0" +theme.border_width = dpi(0) theme.border_normal = "#121212" theme.border_focus = "#292929" theme.titlebar_bg_focus = "#292929" theme.taglist_fg_focus = "#dddcff" theme.taglist_bg_focus = "#121212" -theme.menu_height = 16 -theme.menu_width = 130 +theme.menu_height = dpi(16) +theme.menu_width = dpi(130) theme.menu_submenu_icon = theme.dir .. "/icons/submenu.png" theme.awesome_icon = theme.dir .."/icons/awesome.png" theme.taglist_squares_sel = theme.dir .. "/icons/square_sel.png" @@ -50,7 +51,7 @@ theme.layout_magnifier = theme.dir .. "/icons/magnifier theme.layout_floating = theme.dir .. "/icons/floating.png" theme.tasklist_plain_task_name = true theme.tasklist_disable_icon = true -theme.useless_gap = 10 +theme.useless_gap = dpi(10) theme.titlebar_close_button_focus = theme.dir .. "/icons/titlebar/close_focus.png" theme.titlebar_close_button_normal = theme.dir .. "/icons/titlebar/close_normal.png" theme.titlebar_ontop_button_focus_active = theme.dir .. "/icons/titlebar/ontop_focus_active.png" @@ -219,7 +220,7 @@ function theme.at_screen_connect(s) s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons) -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s, height = 18, bg = theme.bg_normal, fg = theme.fg_normal }) + s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(18), bg = theme.bg_normal, fg = theme.fg_normal }) -- Add widgets to the wibox s.mywibox:setup { diff --git a/themes/holo/theme.lua b/themes/holo/theme.lua index e93c33d..d00a057 100644 --- a/themes/holo/theme.lua +++ b/themes/holo/theme.lua @@ -9,6 +9,7 @@ local gears = require("gears") local lain = require("lain") local awful = require("awful") local wibox = require("wibox") +local dpi = require("beautiful.xresources").apply_dpi local string, os = string, os local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility @@ -25,15 +26,15 @@ theme.bg_focus = "#303030" theme.bg_normal = "#242424" theme.fg_urgent = "#CC9393" theme.bg_urgent = "#006B8E" -theme.border_width = 3 +theme.border_width = dpi(3) theme.border_normal = "#252525" theme.border_focus = "#0099CC" theme.taglist_fg_focus = "#FFFFFF" theme.tasklist_bg_normal = "#222222" theme.tasklist_fg_focus = "#4CB7DB" -theme.menu_height = 20 -theme.menu_width = 160 -theme.menu_icon_size = 32 +theme.menu_height = dpi(20) +theme.menu_width = dpi(160) +theme.menu_icon_size = dpi(32) theme.awesome_icon = theme.icon_dir .. "/awesome_icon_white.png" theme.awesome_icon_launcher = theme.icon_dir .. "/awesome_icon.png" theme.taglist_squares_sel = theme.icon_dir .. "/square_sel.png" @@ -71,7 +72,7 @@ theme.layout_magnifier = theme.icon_dir .. "/magnifier. theme.layout_floating = theme.icon_dir .. "/floating.png" theme.tasklist_plain_task_name = true theme.tasklist_disable_icon = true -theme.useless_gap = 4 +theme.useless_gap = dpi(4) theme.titlebar_close_button_normal = theme.default_dir.."/titlebar/close_normal.png" theme.titlebar_close_button_focus = theme.default_dir.."/titlebar/close_focus.png" theme.titlebar_minimize_button_normal = theme.default_dir.."/titlebar/minimize_normal.png" @@ -104,13 +105,13 @@ local mytextclock = wibox.widget.textclock(markup("#FFFFFF", space3 .. "%H:%M mytextclock.font = theme.font local clock_icon = wibox.widget.imagebox(theme.clock) local clockbg = wibox.container.background(mytextclock, theme.bg_focus, gears.shape.rectangle) -local clockwidget = wibox.container.margin(clockbg, 0, 3, 5, 5) +local clockwidget = wibox.container.margin(clockbg, dpi(0), dpi(3), dpi(5), dpi(5)) -- Calendar local mytextcalendar = wibox.widget.textclock(markup.fontfg(theme.font, "#FFFFFF", space3 .. "%d %b " .. markup.font("Roboto 5", " "))) local calendar_icon = wibox.widget.imagebox(theme.calendar) local calbg = wibox.container.background(mytextcalendar, theme.bg_focus, gears.shape.rectangle) -local calendarwidget = wibox.container.margin(calbg, 0, 0, 5, 5) +local calendarwidget = wibox.container.margin(calbg, dpi(0), dpi(0), dpi(5), dpi(5)) theme.cal = lain.widget.cal({ attach_to = { mytextclock, mytextcalendar }, notification_preset = { @@ -173,7 +174,7 @@ theme.mpd = lain.widget.mpd({ end }) local musicbg = wibox.container.background(theme.mpd.widget, theme.bg_focus, gears.shape.rectangle) -local musicwidget = wibox.container.margin(musicbg, 0, 0, 5, 5) +local musicwidget = wibox.container.margin(musicbg, dpi(0), dpi(0), dpi(5), dpi(5)) musicwidget:buttons(my_table.join(awful.button({ }, 1, function () awful.spawn(theme.musicplr) end))) @@ -222,17 +223,17 @@ theme.fs = lain.widget.fs({ theme.volume = lain.widget.alsabar({ notification_preset = { font = "Monospace 9"}, --togglechannel = "IEC958,3", - width = 80, height = 10, border_width = 0, + width = dpi(80), height = dpi(10), border_width = dpi(0), colors = { background = "#383838", unmute = "#80CCE6", mute = "#FF9F9F" }, }) -theme.volume.bar.paddings = 0 -theme.volume.bar.margins = 5 +theme.volume.bar.paddings = dpi(0) +theme.volume.bar.margins = dpi(5) local volumewidget = wibox.container.background(theme.volume.bar, theme.bg_focus, gears.shape.rectangle) -volumewidget = wibox.container.margin(volumewidget, 0, 0, 5, 5) +volumewidget = wibox.container.margin(volumewidget, dpi(0), dpi(0), dpi(5), dpi(5)) -- CPU local cpu_icon = wibox.widget.imagebox(theme.cpu) @@ -243,7 +244,7 @@ local cpu = lain.widget.cpu({ end }) local cpubg = wibox.container.background(cpu.widget, theme.bg_focus, gears.shape.rectangle) -local cpuwidget = wibox.container.margin(cpubg, 0, 0, 5, 5) +local cpuwidget = wibox.container.margin(cpubg, dpi(0), dpi(0), dpi(5), dpi(5)) -- Net local netdown_icon = wibox.widget.imagebox(theme.net_down) @@ -255,7 +256,7 @@ local net = lain.widget.net({ end }) local netbg = wibox.container.background(net.widget, theme.bg_focus, gears.shape.rectangle) -local networkwidget = wibox.container.margin(netbg, 0, 0, 5, 5) +local networkwidget = wibox.container.margin(netbg, dpi(0), dpi(0), dpi(5), dpi(5)) -- Weather theme.weather = lain.widget.weather({ @@ -279,8 +280,8 @@ local bottom_bar = wibox.widget.imagebox(theme.bottom_bar) local barcolor = gears.color({ type = "linear", - from = { 32, 0 }, - to = { 32, 32 }, + from = { dpi(32), 0 }, + to = { dpi(32), dpi(32) }, stops = { {0, theme.bg_focus}, {0.25, "#505050"}, {1, theme.bg_focus} } }) @@ -313,13 +314,13 @@ function theme.at_screen_connect(s) s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, awful.util.taglist_buttons, { bg_focus = barcolor }) mytaglistcont = wibox.container.background(s.mytaglist, theme.bg_focus, gears.shape.rectangle) - s.mytag = wibox.container.margin(mytaglistcont, 0, 0, 5, 5) + s.mytag = wibox.container.margin(mytaglistcont, dpi(0), dpi(0), dpi(5), dpi(5)) -- Create a tasklist widget s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons, { bg_focus = theme.bg_focus, shape = gears.shape.rectangle, shape_border_width = 5, shape_border_color = theme.tasklist_bg_normal, align = "center" }) -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s, height = 32 }) + s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(32) }) -- Add widgets to the wibox s.mywibox:setup { @@ -356,8 +357,8 @@ function theme.at_screen_connect(s) } -- Create the bottom wibox - s.mybottomwibox = awful.wibar({ position = "bottom", screen = s, border_width = 0, height = 32 }) - s.borderwibox = awful.wibar({ position = "bottom", screen = s, height = 1, bg = theme.fg_focus, x = 0, y = 33}) + s.mybottomwibox = awful.wibar({ position = "bottom", screen = s, border_width = dpi(0), height = dpi(32) }) + s.borderwibox = awful.wibar({ position = "bottom", screen = s, height = dpi(1), bg = theme.fg_focus, x = dpi(0), y = dpi(33)}) -- Add widgets to the bottom wibox s.mybottomwibox:setup { diff --git a/themes/multicolor/theme.lua b/themes/multicolor/theme.lua index 565b841..be1b755 100644 --- a/themes/multicolor/theme.lua +++ b/themes/multicolor/theme.lua @@ -9,6 +9,7 @@ local gears = require("gears") local lain = require("lain") local awful = require("awful") local wibox = require("wibox") +local dpi = require("beautiful.xresources").apply_dpi local os = os local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility @@ -26,12 +27,12 @@ theme.fg_normal = "#aaaaaa" theme.fg_focus = "#ff8c00" theme.fg_urgent = "#af1d18" theme.fg_minimize = "#ffffff" -theme.border_width = 1 +theme.border_width = dpi(1) theme.border_normal = "#1c2022" theme.border_focus = "#606060" theme.border_marked = "#3ca4d8" theme.menu_border_width = 0 -theme.menu_width = 130 +theme.menu_width = dpi(130) theme.menu_submenu_icon = theme.confdir .. "/icons/submenu.png" theme.menu_fg_normal = "#aaaaaa" theme.menu_fg_focus = "#ff8c00" @@ -282,7 +283,7 @@ function theme.at_screen_connect(s) s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons) -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s, height = 20, bg = theme.bg_normal, fg = theme.fg_normal }) + s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(20), bg = theme.bg_normal, fg = theme.fg_normal }) -- Add widgets to the wibox s.mywibox:setup { @@ -326,7 +327,7 @@ function theme.at_screen_connect(s) } -- Create the bottom wibox - s.mybottomwibox = awful.wibar({ position = "bottom", screen = s, border_width = 0, height = 20, bg = theme.bg_normal, fg = theme.fg_normal }) + s.mybottomwibox = awful.wibar({ position = "bottom", screen = s, border_width = 0, height = dpi(20), bg = theme.bg_normal, fg = theme.fg_normal }) -- Add widgets to the bottom wibox s.mybottomwibox:setup { diff --git a/themes/powerarrow-dark/theme.lua b/themes/powerarrow-dark/theme.lua index f70cb64..bcd325f 100644 --- a/themes/powerarrow-dark/theme.lua +++ b/themes/powerarrow-dark/theme.lua @@ -9,6 +9,7 @@ local gears = require("gears") local lain = require("lain") local awful = require("awful") local wibox = require("wibox") +local dpi = require("beautiful.xresources").apply_dpi local os = os local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility @@ -23,7 +24,7 @@ theme.fg_urgent = "#CC9393" theme.bg_normal = "#1A1A1A" theme.bg_focus = "#313131" theme.bg_urgent = "#1A1A1A" -theme.border_width = 1 +theme.border_width = dpi(1) theme.border_normal = "#3F3F3F" theme.border_focus = "#7F7F7F" theme.border_marked = "#CC9393" @@ -31,8 +32,8 @@ theme.tasklist_bg_focus = "#1A1A1A" theme.titlebar_bg_focus = theme.bg_focus theme.titlebar_bg_normal = theme.bg_normal theme.titlebar_fg_focus = theme.fg_focus -theme.menu_height = 16 -theme.menu_width = 140 +theme.menu_height = dpi(16) +theme.menu_width = dpi(140) theme.menu_submenu_icon = theme.dir .. "/icons/submenu.png" theme.taglist_squares_sel = theme.dir .. "/icons/square_sel.png" theme.taglist_squares_unsel = theme.dir .. "/icons/square_unsel.png" @@ -67,7 +68,7 @@ theme.widget_mail = theme.dir .. "/icons/mail.png" theme.widget_mail_on = theme.dir .. "/icons/mail_on.png" theme.tasklist_plain_task_name = true theme.tasklist_disable_icon = true -theme.useless_gap = 0 +theme.useless_gap = dpi(0) theme.titlebar_close_button_focus = theme.dir .. "/icons/titlebar/close_focus.png" theme.titlebar_close_button_normal = theme.dir .. "/icons/titlebar/close_normal.png" theme.titlebar_ontop_button_focus_active = theme.dir .. "/icons/titlebar/ontop_focus_active.png" @@ -289,7 +290,7 @@ function theme.at_screen_connect(s) s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons) -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s, height = 18, bg = theme.bg_normal, fg = theme.fg_normal }) + s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(18), bg = theme.bg_normal, fg = theme.fg_normal }) -- Add widgets to the wibox s.mywibox:setup { diff --git a/themes/powerarrow/binclock.lua b/themes/powerarrow/binclock.lua index 22018a7..68668ea 100644 --- a/themes/powerarrow/binclock.lua +++ b/themes/powerarrow/binclock.lua @@ -8,6 +8,7 @@ local gears = require("gears") local wibox = require("wibox") +local dpi = require("beautiful.xresources").apply_dpi local date = os.date local ipairs = ipairs local math = math @@ -42,8 +43,8 @@ end local function factory(args) local args = args or {} - binclock.width = args.width or 42 - binclock.height = args.height or 18 + binclock.width = args.width or dpi(42) + binclock.height = args.height or dpi(18) binclock.show_seconds = args.show_seconds or false binclock.color_active = args.color_active or "#CCCCCC" binclock.color_inactive = args.color_inactive or "#444444" diff --git a/themes/powerarrow/theme.lua b/themes/powerarrow/theme.lua index 3dac926..136992f 100644 --- a/themes/powerarrow/theme.lua +++ b/themes/powerarrow/theme.lua @@ -9,6 +9,7 @@ local gears = require("gears") local lain = require("lain") local awful = require("awful") local wibox = require("wibox") +local dpi = require("beautiful.xresources").apply_dpi local math, string, os = math, string, os local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility @@ -26,7 +27,7 @@ theme.bg_urgent = "#3F3F3F" theme.taglist_fg_focus = "#00CCFF" theme.tasklist_bg_focus = "#222222" theme.tasklist_fg_focus = "#00CCFF" -theme.border_width = 1 +theme.border_width = dpi(2) theme.border_normal = "#3F3F3F" theme.border_focus = "#6F6F6F" theme.border_marked = "#CC9393" @@ -35,8 +36,8 @@ theme.titlebar_bg_normal = "#3F3F3F" theme.titlebar_bg_focus = theme.bg_focus theme.titlebar_bg_normal = theme.bg_normal theme.titlebar_fg_focus = theme.fg_focus -theme.menu_height = 16 -theme.menu_width = 140 +theme.menu_height = dpi(16) +theme.menu_width = dpi(140) theme.menu_submenu_icon = theme.dir .. "/icons/submenu.png" theme.awesome_icon = theme.dir .. "/icons/awesome.png" theme.taglist_squares_sel = theme.dir .. "/icons/square_sel.png" @@ -102,7 +103,7 @@ local separators = lain.util.separators -- Binary clock local binclock = require("themes.powerarrow.binclock"){ - height = 16, + height = dpi(32), show_seconds = true, color_active = theme.fg_normal, color_inactive = theme.bg_focus @@ -304,7 +305,7 @@ function theme.powerline_rl(cr, width, height) end local function pl(widget, bgcolor, padding) - return wibox.container.background(wibox.container.margin(widget, 16, 16), bgcolor, theme.powerline_rl) + return wibox.container.background(wibox.container.margin(widget, dpi(16), dpi(16)), bgcolor, theme.powerline_rl) end function theme.at_screen_connect(s) @@ -339,7 +340,7 @@ function theme.at_screen_connect(s) s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons) -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s, height = 16, bg = theme.bg_normal, fg = theme.fg_normal }) + s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(16), bg = theme.bg_normal, fg = theme.fg_normal }) -- Add widgets to the wibox s.mywibox:setup { @@ -355,7 +356,7 @@ function theme.at_screen_connect(s) { -- Right widgets layout = wibox.layout.fixed.horizontal, wibox.widget.systray(), - wibox.container.margin(scissors, 4, 8), + wibox.container.margin(scissors, dpi(4), dpi(8)), --[[ using shapes pl(wibox.widget { mpdicon, theme.mpd.widget, layout = wibox.layout.align.horizontal }, "#343434"), pl(task, "#343434"), @@ -370,25 +371,25 @@ function theme.at_screen_connect(s) --]] -- using separators arrow(theme.bg_normal, "#343434"), - wibox.container.background(wibox.container.margin(wibox.widget { mailicon, theme.mail and theme.mail.widget, layout = wibox.layout.align.horizontal }, 4, 7), "#343434"), + wibox.container.background(wibox.container.margin(wibox.widget { mailicon, theme.mail and theme.mail.widget, layout = wibox.layout.align.horizontal }, dpi(4), dpi(7)), "#343434"), arrow("#343434", theme.bg_normal), - wibox.container.background(wibox.container.margin(wibox.widget { mpdicon, theme.mpd.widget, layout = wibox.layout.align.horizontal }, 3, 6), theme.bg_focus), + wibox.container.background(wibox.container.margin(wibox.widget { mpdicon, theme.mpd.widget, layout = wibox.layout.align.horizontal }, dpi(3), dpi(6)), theme.bg_focus), arrow(theme.bg_normal, "#343434"), - wibox.container.background(wibox.container.margin(task, 3, 7), "#343434"), + wibox.container.background(wibox.container.margin(task, dpi(3), dpi(7)), "#343434"), arrow("#343434", "#777E76"), - wibox.container.background(wibox.container.margin(wibox.widget { memicon, mem.widget, layout = wibox.layout.align.horizontal }, 2, 3), "#777E76"), + wibox.container.background(wibox.container.margin(wibox.widget { memicon, mem.widget, layout = wibox.layout.align.horizontal }, dpi(2), dpi(3)), "#777E76"), arrow("#777E76", "#4B696D"), - wibox.container.background(wibox.container.margin(wibox.widget { cpuicon, cpu.widget, layout = wibox.layout.align.horizontal }, 3, 4), "#4B696D"), + wibox.container.background(wibox.container.margin(wibox.widget { cpuicon, cpu.widget, layout = wibox.layout.align.horizontal }, dpi(3), dpi(4)), "#4B696D"), arrow("#4B696D", "#4B3B51"), - wibox.container.background(wibox.container.margin(wibox.widget { tempicon, temp.widget, layout = wibox.layout.align.horizontal }, 4, 4), "#4B3B51"), + wibox.container.background(wibox.container.margin(wibox.widget { tempicon, temp.widget, layout = wibox.layout.align.horizontal }, dpi(4), dpi(4)), "#4B3B51"), arrow("#4B3B51", "#CB755B"), - wibox.container.background(wibox.container.margin(wibox.widget { fsicon, theme.fs and theme.fs.widget, layout = wibox.layout.align.horizontal }, 3, 3), "#CB755B"), + wibox.container.background(wibox.container.margin(wibox.widget { fsicon, theme.fs and theme.fs.widget, layout = wibox.layout.align.horizontal }, dpi(3), dpi(3)), "#CB755B"), arrow("#CB755B", "#8DAA9A"), - wibox.container.background(wibox.container.margin(wibox.widget { baticon, bat.widget, layout = wibox.layout.align.horizontal }, 3, 3), "#8DAA9A"), + wibox.container.background(wibox.container.margin(wibox.widget { baticon, bat.widget, layout = wibox.layout.align.horizontal }, dpi(3), dpi(3)), "#8DAA9A"), arrow("#8DAA9A", "#C0C0A2"), - wibox.container.background(wibox.container.margin(wibox.widget { nil, neticon, net.widget, layout = wibox.layout.align.horizontal }, 3, 3), "#C0C0A2"), + wibox.container.background(wibox.container.margin(wibox.widget { nil, neticon, net.widget, layout = wibox.layout.align.horizontal }, dpi(3), dpi(3)), "#C0C0A2"), arrow("#C0C0A2", "#777E76"), - wibox.container.background(wibox.container.margin(binclock.widget, 4, 8), "#777E76"), + wibox.container.background(wibox.container.margin(binclock.widget, dpi(4), dpi(8)), "#777E76"), arrow("#777E76", "alpha"), --]] s.mylayoutbox, diff --git a/themes/rainbow/theme.lua b/themes/rainbow/theme.lua index 3402c5e..f516452 100644 --- a/themes/rainbow/theme.lua +++ b/themes/rainbow/theme.lua @@ -9,6 +9,7 @@ local gears = require("gears") local lain = require("lain") local awful = require("awful") local wibox = require("wibox") +local dpi = require("beautiful.xresources").apply_dpi local os = os local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility @@ -24,13 +25,13 @@ theme.bg_normal = "#242424" theme.bg_focus = "#242424" theme.fg_urgent = "#000000" theme.bg_urgent = "#FFFFFF" -theme.border_width = 1 +theme.border_width = dpi(1) theme.border_normal = "#242424" theme.border_focus = "#EBEBFF" theme.taglist_fg_focus = "#EDEFFF" theme.taglist_bg_focus = "#242424" -theme.menu_height = 16 -theme.menu_width = 140 +theme.menu_height = dpi(16) +theme.menu_width = dpi(140) theme.ocol = "" theme.tasklist_sticky = theme.ocol .. "[S]" theme.tasklist_ontop = theme.ocol .. "[T]" @@ -42,7 +43,7 @@ theme.awesome_icon = theme.dir .."/icons/awesome.pn theme.menu_submenu_icon = theme.dir .."/icons/submenu.png" theme.taglist_squares_sel = theme.dir .. "/icons/square_sel.png" theme.taglist_squares_unsel = theme.dir .. "/icons/square_unsel.png" -theme.useless_gap = 8 +theme.useless_gap = dpi(8) theme.layout_txt_tile = "[t]" theme.layout_txt_tileleft = "[l]" theme.layout_txt_tilebottom = "[b]" @@ -163,7 +164,7 @@ theme.fs = lain.widget.fs({ -- ALSA volume bar theme.volume = lain.widget.alsabar({ - ticks = true, width = 67, + ticks = true, width = dpi(67), notification_preset = { font = theme.font } }) theme.volume.tooltip.wibox.fg = theme.fg_focus @@ -190,7 +191,7 @@ theme.volume.bar:buttons(my_table.join ( end) )) local volumebg = wibox.container.background(theme.volume.bar, "#585858", gears.shape.rectangle) -local volumewidget = wibox.container.margin(volumebg, 7, 7, 5, 5) +local volumewidget = wibox.container.margin(volumebg, dpi(7), dpi(7), dpi(5), dpi(5)) -- Weather theme.weather = lain.widget.weather({ @@ -243,7 +244,7 @@ function theme.at_screen_connect(s) s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons) -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s, height = 18, bg = theme.bg_normal, fg = theme.fg_normal }) + s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(18), bg = theme.bg_normal, fg = theme.fg_normal }) -- Add widgets to the wibox s.mywibox:setup { diff --git a/themes/steamburn/theme.lua b/themes/steamburn/theme.lua index acb709d..f641d9e 100644 --- a/themes/steamburn/theme.lua +++ b/themes/steamburn/theme.lua @@ -9,6 +9,7 @@ local gears = require("gears") local lain = require("lain") local awful = require("awful") local wibox = require("wibox") +local dpi = require("beautiful.xresources").apply_dpi local os = os local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility @@ -24,7 +25,7 @@ theme.fg_urgent = "#CC9393" theme.bg_normal = "#140c0b" theme.bg_focus = "#140c0b" theme.bg_urgent = "#2a1f1e" -theme.border_width = 1 +theme.border_width = dpi(1) theme.border_normal = "#302627" theme.border_focus = "#c2745b" theme.border_marked = "#CC9393" @@ -33,8 +34,8 @@ theme.tasklist_bg_focus = "#140c0b" theme.tasklist_fg_focus = "#d88166" theme.taglist_squares_sel = theme.dir .. "/icons/square_sel.png" theme.taglist_squares_unsel = theme.dir .. "/icons/square_unsel.png" -theme.menu_height = 16 -theme.menu_width = 140 +theme.menu_height = dpi(16) +theme.menu_width = dpi(140) theme.awesome_icon = theme.dir .."/icons/awesome.png" theme.menu_submenu_icon = theme.dir .. "/icons/submenu.png" theme.layout_txt_tile = "[t]" @@ -51,7 +52,7 @@ theme.layout_txt_magnifier = "[M]" theme.layout_txt_floating = "[|]" theme.tasklist_plain_task_name = true theme.tasklist_disable_icon = true -theme.useless_gap = 0 +theme.useless_gap = dpi(0) theme.titlebar_close_button_normal = theme.zenburn_dir.."/titlebar/close_normal.png" theme.titlebar_close_button_focus = theme.zenburn_dir.."/titlebar/close_focus.png" theme.titlebar_minimize_button_normal = theme.zenburn_dir.."/titlebar/minimize_normal.png" @@ -239,7 +240,7 @@ function theme.at_screen_connect(s) s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons) -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s, height = 18 }) + s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(18) }) -- Add widgets to the wibox s.mywibox:setup { diff --git a/themes/vertex/theme.lua b/themes/vertex/theme.lua index 50caa72..87a4e3f 100644 --- a/themes/vertex/theme.lua +++ b/themes/vertex/theme.lua @@ -9,6 +9,7 @@ local gears = require("gears") local lain = require("lain") local awful = require("awful") local wibox = require("wibox") +local dpi = require("beautiful.xresources").apply_dpi local math, string, tag, tonumber, type, os = math, string, tag, tonumber, type, os local my_table = awful.util.table or gears.table -- 4.{0,1} compatibility @@ -26,16 +27,16 @@ theme.bg_focus2 = "#3762B8" theme.bg_normal = "#242424" theme.fg_urgent = "#CC9393" theme.bg_urgent = "#006B8E" -theme.border_width = 4 +theme.border_width = dpi(4) theme.border_normal = "#252525" theme.border_focus = "#7CA2EE" theme.tooltip_border_color = theme.fg_focus theme.tooltip_border_width = theme.border_width -theme.menu_height = 24 -theme.menu_width = 140 +theme.menu_height = dpi(24) +theme.menu_width = dpi(140) theme.awesome_icon = theme.icon_dir .. "/awesome.png" -theme.taglist_squares_sel = gears.surface.load_from_shape(3, 30, gears.shape.rectangle, theme.fg_focus) -theme.taglist_squares_unsel = gears.surface.load_from_shape(3, 30, gears.shape.rectangle, theme.bg_focus2) +theme.taglist_squares_sel = gears.surface.load_from_shape(dpi(3), dpi(30), gears.shape.rectangle, theme.fg_focus) +theme.taglist_squares_unsel = gears.surface.load_from_shape(dpi(3), dpi(30), gears.shape.rectangle, theme.bg_focus2) theme.panelbg = theme.icon_dir .. "/panel.png" theme.bat000charging = theme.icon_dir .. "/bat-000-charging.png" theme.bat000 = theme.icon_dir .. "/bat-000.png" @@ -82,7 +83,7 @@ theme.layout_cornersw = theme.default_dir.."/layouts/c theme.layout_cornerse = theme.default_dir.."/layouts/cornersew.png" theme.tasklist_plain_task_name = true theme.tasklist_disable_icon = true -theme.useless_gap = 10 +theme.useless_gap = dpi(10) theme.titlebar_close_button_normal = theme.default_dir.."/titlebar/close_normal.png" theme.titlebar_close_button_focus = theme.default_dir.."/titlebar/close_focus.png" theme.titlebar_minimize_button_normal = theme.default_dir.."/titlebar/minimize_normal.png" @@ -127,14 +128,14 @@ theme.cal = lain.widget.cal({ local baticon = wibox.widget.imagebox(theme.bat000) local battooltip = awful.tooltip({ objects = { baticon }, - margin_leftright = 15, - margin_topbottom = 12 + margin_leftright = dpi(15), + margin_topbottom = dpi(12) }) battooltip.wibox.fg = theme.fg_normal battooltip.textbox.font = theme.font battooltip.timeout = 0 battooltip:set_shape(function(cr, width, height) - gears.shape.infobubble(cr, width, height, corner_radius, arrow_size, width - 35) + gears.shape.infobubble(cr, width, height, corner_radius, arrow_size, width - dpi(35)) end) local bat = lain.widget.bat({ settings = function() @@ -233,14 +234,14 @@ volicon:buttons(my_table.join ( local wificon = wibox.widget.imagebox(theme.wifidisc) local wifitooltip = awful.tooltip({ objects = { wificon }, - margin_leftright = 15, - margin_topbottom = 15 + margin_leftright = dpi(15), + margin_topbottom = dpi(15) }) wifitooltip.wibox.fg = theme.fg_normal wifitooltip.textbox.font = theme.font wifitooltip.timeout = 0 wifitooltip:set_shape(function(cr, width, height) - gears.shape.infobubble(cr, width, height, corner_radius, arrow_size, width - 120) + gears.shape.infobubble(cr, width, height, corner_radius, arrow_size, width - dpi(120)) end) local mywifisig = awful.widget.watch( { awful.util.shell, "-c", "awk 'NR==3 {printf(\"%d-%.0f\\n\",$2, $3*10/7)}' /proc/net/wireless; iw dev wlan0 link" }, @@ -292,30 +293,30 @@ local rspace0 = wibox.widget.textbox() local rspace2 = wibox.widget.textbox() local rspace3 = wibox.widget.textbox() local tspace1 = wibox.widget.textbox() -tspace1.forced_width = 18 -rspace1.forced_width = 16 -rspace0.forced_width = 18 -rspace2.forced_width = 19 -rspace3.forced_width = 21 +tspace1.forced_width = dpi(18) +rspace1.forced_width = dpi(16) +rspace0.forced_width = dpi(18) +rspace2.forced_width = dpi(19) +rspace3.forced_width = dpi(21) local lspace1 = wibox.widget.textbox() local lspace2 = wibox.widget.textbox() local lspace3 = wibox.widget.textbox() -lspace1.forced_height = 18 -lspace2.forced_height = 10 -lspace3.forced_height = 16 +lspace1.forced_height = dpi(18) +lspace2.forced_height = dpi(10) +lspace3.forced_height = dpi(16) local barcolor = gears.color({ type = "linear", - from = { 0, 46 }, - to = { 46, 46 }, + from = { 0, dpi(46) }, + to = { dpi(46), dpi(46) }, stops = { {0, theme.bg_focus}, {0.9, theme.bg_focus2} } }) local barcolor2 = gears.color({ type = "linear", - from = { 0, 46 }, - to = { 46, 46 }, + from = { 0, dpi(46) }, + to = { dpi(46), dpi(46) }, stops = { {0, "#323232"}, {1, theme.bg_normal} } }) @@ -327,7 +328,7 @@ function theme.vertical_wibox(s) -- Create the vertical wibox s.dockheight = (35 * s.workarea.height)/100 - s.myleftwibox = wibox({ screen = s, x=0, y=s.workarea.height/2 - s.dockheight/2, width = 6, height = s.dockheight, fg = theme.fg_normal, bg = barcolor2, ontop = true, visible = true, type = "dock" }) + s.myleftwibox = wibox({ screen = s, x=0, y=s.workarea.height/2 - s.dockheight/2, width = dpi(6), height = s.dockheight, fg = theme.fg_normal, bg = barcolor2, ontop = true, visible = true, type = "dock" }) if s.index > 1 and s.myleftwibox.y == 0 then s.myleftwibox.y = screen[1].myleftwibox.y @@ -342,7 +343,7 @@ function theme.vertical_wibox(s) s.mytaglist, lspace2, s.layoutb, - wibox.container.margin(mylauncher, 5, 8, 13, 0), + wibox.container.margin(mylauncher, dpi(5), dpi(8), dpi(13), dpi(0)), }, } @@ -350,7 +351,7 @@ function theme.vertical_wibox(s) s.docktimer = gears.timer{ timeout = 2 } s.docktimer:connect_signal("timeout", function() local s = awful.screen.focused() - s.myleftwibox.width = 9 + s.myleftwibox.width = dpi(9) s.layoutb.visible = false mylauncher.visible = false if s.docktimer.started then @@ -359,7 +360,7 @@ function theme.vertical_wibox(s) end) tag.connect_signal("property::selected", function(t) local s = t.screen or awful.screen.focused() - s.myleftwibox.width = 38 + s.myleftwibox.width = dpi(38) s.layoutb.visible = true mylauncher.visible = true gears.surface.apply_shape_bounding(s.myleftwibox, dockshape) @@ -370,14 +371,14 @@ function theme.vertical_wibox(s) s.myleftwibox:connect_signal("mouse::leave", function() local s = awful.screen.focused() - s.myleftwibox.width = 9 + s.myleftwibox.width = dpi(9) s.layoutb.visible = false mylauncher.visible = false end) s.myleftwibox:connect_signal("mouse::enter", function() local s = awful.screen.focused() - s.myleftwibox.width = 38 + s.myleftwibox.width = dpi(38) s.layoutb.visible = true mylauncher.visible = true gears.surface.apply_shape_bounding(s.myleftwibox, dockshape) @@ -412,13 +413,13 @@ function theme.at_screen_connect(s) awful.button({}, 3, function () awful.layout.inc(-1) end), awful.button({}, 4, function () awful.layout.inc( 1) end), awful.button({}, 5, function () awful.layout.inc(-1) end))) - s.layoutb = wibox.container.margin(s.mylayoutbox, 8, 11, 3, 3) + s.layoutb = wibox.container.margin(s.mylayoutbox, dpi(8), dpi(11), dpi(3), dpi(3)) -- Create a taglist widget s.mytaglist = awful.widget.taglist(s, awful.widget.taglist.filter.all, awful.util.taglist_buttons, { font = theme.taglist_font, shape = gears.shape.rectangle, - spacing = 10, + spacing = dpi(10), square_unsel = theme.square_unsel, bg_focus = barcolor }, nil, wibox.layout.fixed.vertical()) @@ -427,7 +428,7 @@ function theme.at_screen_connect(s) s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.focused, awful.util.tasklist_buttons, { bg_focus = "#00000000" }) -- Create the wibox - s.mywibox = awful.wibar({ position = "top", screen = s, height = 25, bg = gears.color.create_png_pattern(theme.panelbg) }) + s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(25), bg = gears.color.create_png_pattern(theme.panelbg) }) local wiboxlayout = wibox.layout.align.horizontal() wiboxlayout.expand = "none"