make useless_gap usage more friendly; minor fix

This commit is contained in:
Xinhao Yuan 2019-07-21 12:03:55 -04:00
parent 1942d63421
commit a1b6eef873
3 changed files with 16 additions and 14 deletions

View File

@ -138,10 +138,9 @@ To differentiate tags with the same name, you may need a more advanced naming fu
## Caveats
`beautiful.useless_gap` is handled differently in layout-machi and it doesn't cooperate well with the standard way.
In my usage I set `gap = 0` for the tags and let machi handle the gaps.
1. layout-machi handles `beautiful.useless_gap` slightly differently.
Also, true transparency is required. Otherwise switcher and editor will block the clients.
2. True transparency is required. Otherwise switcher and editor will block the clients.
## TODO

View File

@ -458,8 +458,8 @@ local function create(data)
end
local function start_interactive(screen, layout)
local outer_gap = data.outer_gap or data.gap or api.beautiful.useless_gap or 0
local inner_gap = data.inner_gap or data.gap or api.beautiful.useless_gap or 0
local outer_gap = data.outer_gap or data.gap or api.beautiful.useless_gap * 2 or 0
local inner_gap = data.inner_gap or data.gap or api.beautiful.useless_gap * 2 or 0
local label_font_family = api.beautiful.get_font(
api.beautiful.mono_font or api.beautiful.font):get_family()
local label_size = api.dpi(30)
@ -718,8 +718,8 @@ local function create(data)
end
local function run_cmd(init_area, cmd)
local outer_gap = data.outer_gap or data.gap or api.beautiful.useless_gap or 0
local inner_gap = data.inner_gap or data.gap or api.beautiful.useless_gap or 0
local outer_gap = data.outer_gap or data.gap or api.beautiful.useless_gap * 2 or 0
local inner_gap = data.inner_gap or data.gap or api.beautiful.useless_gap * 2 or 0
init(init_area)
push_history()

View File

@ -85,7 +85,8 @@ local function create(name, editor)
end
local function arrange(p)
local wa = p.workarea
local useless_gap = p.useless_gap
local wa = get_screen(p.screen).workarea -- get the real workarea without the gap (instead of p.workarea)
local cls = p.clients
local regions = get_regions(wa, get_screen(p.screen).selected_tag)
@ -104,11 +105,13 @@ local function create(name, editor)
end
local region = c.machi_region
-- Editor already handled useless_gap in the stored regions.
-- We try to negate the gap of outer layer.
p.geometries[c] = {
x = regions[region].x,
y = regions[region].y,
width = regions[region].width,
height = regions[region].height,
x = regions[region].x - useless_gap,
y = regions[region].y - useless_gap,
width = regions[region].width + useless_gap * 2,
height = regions[region].height + useless_gap * 2,
}
print("Put client " .. tostring(c) .. " to region " .. region)
@ -146,8 +149,8 @@ local function create(name, editor)
c.machi_region = choice
c.x = regions[choice].x
c.y = regions[choice].y
c.width = regions[choice].width
c.height = regions[choice].height
c.width = max(1, regions[choice].width - 2 * border_width)
c.height = max(1, regions[choice].height - 2 * border_width)
end
end