Apply suggestions from code review
Co-authored-by: Aire-One <Aire-One@users.noreply.github.com>
This commit is contained in:
parent
d5d74e44de
commit
6ad693eff0
|
@ -71,11 +71,11 @@ local align_map = {
|
|||
--
|
||||
-- Values are:
|
||||
--
|
||||
-- * top
|
||||
-- * bottom
|
||||
-- * left
|
||||
-- * right
|
||||
-- * centered
|
||||
-- * `"top"`
|
||||
-- * `"bottom"`
|
||||
-- * `"left"`
|
||||
-- * `"right"`
|
||||
-- * `"centered"`
|
||||
--
|
||||
-- @DOC_awful_wibar_align_EXAMPLE@
|
||||
--
|
||||
|
@ -87,8 +87,8 @@ local align_map = {
|
|||
|
||||
--- Margins on each side of the wibar.
|
||||
--
|
||||
-- It can either be a table if `top`, `bottom`, `left`, `right` or a
|
||||
-- single number.
|
||||
-- It can either be a table with `top`, `bottom`, `left` and `right`
|
||||
-- properties, or a single number that apply to all fourth sides.
|
||||
--
|
||||
-- @DOC_awful_wibar_margins_EXAMPLE@
|
||||
--
|
||||
|
@ -385,12 +385,12 @@ function awfulwibar.set_margins(w, value)
|
|||
}
|
||||
end
|
||||
|
||||
value = value or {
|
||||
value = gtable.crush({
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0
|
||||
}
|
||||
}, value or {}, true)
|
||||
|
||||
w._private.margins = value
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ local args = loadfile(file_path)() or 10
|
|||
args = args or {}
|
||||
args.factor = args.factor or 10
|
||||
|
||||
local SCALE_FACTOR = 0.66
|
||||
|
||||
local factor, img, cr = 1/args.factor
|
||||
|
||||
require("gears.timer").run_delayed_calls_now()
|
||||
|
@ -470,7 +472,7 @@ local function draw_struts(s)
|
|||
if left > 0 then
|
||||
draw_hruler(
|
||||
s,
|
||||
s.geometry.y*0.66,
|
||||
s.geometry.y*SCALE_FACTOR,
|
||||
get_text_height(),
|
||||
{x = s.geometry.x+tr_x*2, width = left, color = colors.gaps.."66", align = true},
|
||||
1
|
||||
|
@ -481,7 +483,7 @@ local function draw_struts(s)
|
|||
draw_vruler(
|
||||
s,
|
||||
get_text_height()*1.5,
|
||||
s.geometry.x*0.66,
|
||||
s.geometry.x*SCALE_FACTOR,
|
||||
{y=s.geometry.y+tr_y*(1/factor), height = top, color = colors.gaps.."66", align = true},
|
||||
1
|
||||
)
|
||||
|
@ -490,7 +492,7 @@ local function draw_struts(s)
|
|||
if right > 0 then
|
||||
draw_hruler(
|
||||
s,
|
||||
s.geometry.y*0.66,
|
||||
s.geometry.y*SCALE_FACTOR,
|
||||
get_text_height(),
|
||||
{x = s.geometry.x, width = left, color = colors.gaps.."66", align = true},
|
||||
1
|
||||
|
@ -501,7 +503,7 @@ local function draw_struts(s)
|
|||
draw_vruler(
|
||||
s,
|
||||
get_text_height()*1.5,
|
||||
s.geometry.x*0.66,
|
||||
s.geometry.x*SCALE_FACTOR,
|
||||
{
|
||||
y = s.geometry.y+tr_y*(1/factor)+s.geometry.height - bottom,
|
||||
height = bottom,
|
||||
|
@ -689,7 +691,7 @@ evaluate_translation(
|
|||
local sew, seh = screen._get_extents()
|
||||
sew, seh = sew/args.factor + (screen.count()-1)*10+2, seh/args.factor+2
|
||||
|
||||
sew, seh = sew + tr_x, seh + 0.66*tr_y
|
||||
sew, seh = sew + tr_x, seh + SCALE_FACTOR*tr_y
|
||||
|
||||
sew, seh = sew + 5*get_text_height(), seh + 5*get_text_height()
|
||||
|
||||
|
@ -697,7 +699,7 @@ img = cairo.SvgSurface.create(image_path..".svg", sew, seh)
|
|||
cr = cairo.Context(img)
|
||||
|
||||
-- Instead of adding origin offset everywhere, translate the viewport.
|
||||
cr:translate(tr_x, tr_y * 0.66)
|
||||
cr:translate(tr_x, tr_y * SCALE_FACTOR)
|
||||
|
||||
-- Draw the various areas.
|
||||
for k=1, screen.count() do
|
||||
|
|
Loading…
Reference in New Issue