mirror of https://github.com/lcpz/lain.git
Window border width issue fixes in uselesstile
This commit is contained in:
parent
10d2bbefe4
commit
2968bb25bd
|
@ -1,12 +1,12 @@
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
|
|
||||||
Licensed under GNU General Public License v2
|
Licensed under GNU General Public License v2
|
||||||
* (c) 2014 projektile
|
* (c) 2014 projektile
|
||||||
* (c) 2013 Luke Bonham
|
* (c) 2013 Luke Bonham
|
||||||
* (c) 2009 Donald Ephraim Curtis
|
* (c) 2009 Donald Ephraim Curtis
|
||||||
* (c) 2008 Julien Danjolu
|
* (c) 2008 Julien Danjolu
|
||||||
|
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
local tag = require("awful.tag")
|
local tag = require("awful.tag")
|
||||||
|
@ -19,16 +19,7 @@ local tonumber = tonumber
|
||||||
|
|
||||||
local uselesstile = {}
|
local uselesstile = {}
|
||||||
|
|
||||||
local function tile_group(cls, wa, orientation, fact, group)
|
local function tile_group(cls, wa, orientation, fact, group, gap)
|
||||||
-- A useless gap (like the dwm patch) can be defined with
|
|
||||||
-- beautiful.useless_gap_width .
|
|
||||||
local useless_gap = tonumber(beautiful.useless_gap_width) or 0
|
|
||||||
if useless_gap < 0 then useless_gap = 0 end
|
|
||||||
|
|
||||||
-- A global border can be defined with
|
|
||||||
-- beautiful.global_border_width
|
|
||||||
local global_border = tonumber(beautiful.global_border_width) or 0
|
|
||||||
if global_border < 0 then global_border = 0 end
|
|
||||||
|
|
||||||
-- Themes border width requires an offset
|
-- Themes border width requires an offset
|
||||||
local bw = tonumber(beautiful.border_width) or 0
|
local bw = tonumber(beautiful.border_width) or 0
|
||||||
|
@ -69,58 +60,28 @@ local function tile_group(cls, wa, orientation, fact, group)
|
||||||
end
|
end
|
||||||
total_fact = total_fact + fact[i]
|
total_fact = total_fact + fact[i]
|
||||||
end
|
end
|
||||||
size = math.min(size, (available - global_border))
|
size = math.min(size, available)
|
||||||
local coord = wa[y]
|
local coord = wa[y]
|
||||||
local geom = {}
|
local geom = {}
|
||||||
local used_size = 0
|
local used_size = 0
|
||||||
local unused = wa[height] - (global_border * 2)
|
local unused = wa[height]
|
||||||
local stat_coord = wa[x]
|
local stat_coord = wa[x]
|
||||||
--stat_coord = size
|
--stat_coord = size
|
||||||
for c = group.first,group.last do
|
for c = group.first,group.last do
|
||||||
local i = c - group.first +1
|
local i = c - group.first +1
|
||||||
geom[width] = size - global_border - (bw * 2)
|
geom[width] = size - (bw * 2)
|
||||||
geom[height] = math.floor(unused * fact[i] / total_fact) - (bw * 2)
|
geom[height] = math.floor(unused * fact[i] / total_fact) - (bw * 2)
|
||||||
geom[x] = group.coord + global_border
|
geom[x] = group.coord
|
||||||
geom[y] = coord + global_border
|
geom[y] = coord
|
||||||
|
|
||||||
coord = coord + geom[height]
|
coord = coord + geom[height] + 2 * bw
|
||||||
unused = unused - geom[height]
|
unused = unused - geom[height] - 2 * bw
|
||||||
total_fact = total_fact - fact[i]
|
total_fact = total_fact - fact[i]
|
||||||
used_size = math.max(used_size, geom[width])
|
used_size = math.max(used_size, geom[width] + 2 * bw)
|
||||||
|
|
||||||
-- Useless gap
|
-- Useless gap correction
|
||||||
if useless_gap > 0
|
geom.width = geom.width - gap
|
||||||
then
|
geom.height = geom.height - gap
|
||||||
-- Top and left clients are shrinked by two steps and
|
|
||||||
-- get moved away from the border. Other clients just
|
|
||||||
-- get shrinked in one direction.
|
|
||||||
|
|
||||||
top = false
|
|
||||||
left = false
|
|
||||||
|
|
||||||
if geom[y] == wa[y] then
|
|
||||||
top = true
|
|
||||||
end
|
|
||||||
|
|
||||||
if geom[x] == 0 or geom[x] == wa[x] then
|
|
||||||
left = true
|
|
||||||
end
|
|
||||||
|
|
||||||
if top then
|
|
||||||
geom[height] = geom[height] - (2 * useless_gap)
|
|
||||||
geom[y] = geom[y] + useless_gap
|
|
||||||
else
|
|
||||||
geom[height] = geom[height] - useless_gap
|
|
||||||
end
|
|
||||||
|
|
||||||
if left then
|
|
||||||
geom[width] = geom[width] - (2 * useless_gap)
|
|
||||||
geom[x] = geom[x] + useless_gap
|
|
||||||
else
|
|
||||||
geom[width] = geom[width] - useless_gap
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- End of useless gap.
|
|
||||||
|
|
||||||
geom = cls[c]:geometry(geom)
|
geom = cls[c]:geometry(geom)
|
||||||
end
|
end
|
||||||
|
@ -132,6 +93,16 @@ local function tile(param, orientation)
|
||||||
local t = tag.selected(param.screen)
|
local t = tag.selected(param.screen)
|
||||||
orientation = orientation or "right"
|
orientation = orientation or "right"
|
||||||
|
|
||||||
|
-- A useless gap (like the dwm patch) can be defined with
|
||||||
|
-- beautiful.useless_gap_width .
|
||||||
|
local useless_gap = tonumber(beautiful.useless_gap_width) or 0
|
||||||
|
if useless_gap < 0 then useless_gap = 0 end
|
||||||
|
|
||||||
|
-- A global border can be defined with
|
||||||
|
-- beautiful.global_border_width
|
||||||
|
local global_border = tonumber(beautiful.global_border_width) or 0
|
||||||
|
if global_border < 0 then global_border = 0 end
|
||||||
|
|
||||||
-- this handles are different orientations
|
-- this handles are different orientations
|
||||||
local height = "height"
|
local height = "height"
|
||||||
local width = "width"
|
local width = "width"
|
||||||
|
@ -152,6 +123,12 @@ local function tile(param, orientation)
|
||||||
local wa = param.workarea
|
local wa = param.workarea
|
||||||
local ncol = tag.getncol(t)
|
local ncol = tag.getncol(t)
|
||||||
|
|
||||||
|
-- Workarea size correction
|
||||||
|
wa.height = wa.height - 2 * global_border - useless_gap
|
||||||
|
wa.width = wa.width - 2 * global_border - useless_gap
|
||||||
|
wa.x = wa.x + useless_gap + global_border
|
||||||
|
wa.y = wa.y + useless_gap + global_border
|
||||||
|
|
||||||
local data = tag.getdata(t).windowfact
|
local data = tag.getdata(t).windowfact
|
||||||
|
|
||||||
if not data then
|
if not data then
|
||||||
|
@ -176,7 +153,7 @@ local function tile(param, orientation)
|
||||||
if not data[0] then
|
if not data[0] then
|
||||||
data[0] = {}
|
data[0] = {}
|
||||||
end
|
end
|
||||||
coord = coord + tile_group(cls, wa, orientation, data[0], {first=1, last=nmaster, coord = coord, size = size})
|
coord = coord + tile_group(cls, wa, orientation, data[0], {first=1, last=nmaster, coord = coord, size = size}, useless_gap)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not place_master and nother > 0 then
|
if not place_master and nother > 0 then
|
||||||
|
@ -196,7 +173,7 @@ local function tile(param, orientation)
|
||||||
if not data[i] then
|
if not data[i] then
|
||||||
data[i] = {}
|
data[i] = {}
|
||||||
end
|
end
|
||||||
coord = coord + tile_group(cls, wa, orientation, data[i], { first = first, last = last, coord = coord, size = size })
|
coord = coord + tile_group(cls, wa, orientation, data[i], { first = first, last = last, coord = coord, size = size }, useless_gap)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
place_master = not place_master
|
place_master = not place_master
|
||||||
|
|
Loading…
Reference in New Issue