mirror of https://github.com/lcpz/lain.git
termfair: move common variables to the top of the function.
This commit is contained in:
parent
6f3c709b42
commit
8e9d741761
|
@ -22,6 +22,13 @@ local function do_fair(p, orientation)
|
|||
|
||||
if #cls == 0 then return end
|
||||
|
||||
-- How many vertical columns? Read from nmaster on the tag.
|
||||
local num_x = tonumber(termfair.nmaster) or t.master_count
|
||||
local ncol = tonumber(termfair.ncol) or t.column_count
|
||||
if num_x <= 2 then num_x = 2 end
|
||||
if ncol <= 1 then ncol = 1 end
|
||||
local width = math.floor(wa.width/num_x)
|
||||
|
||||
if orientation == "west" then
|
||||
-- Layout with fixed number of vertical columns (read from nmaster).
|
||||
-- New windows align from left to right. When a row is full, a new
|
||||
|
@ -41,14 +48,6 @@ local function do_fair(p, orientation)
|
|||
-- | 2 | 3 | 4 | | 3 | 4 | 5 | | 4 | 5 | 6 |
|
||||
-- +---+---+---+ +---+---+---+ +---+---+---+
|
||||
|
||||
-- How many vertical columns? Read from nmaster on the tag.
|
||||
local num_x = tonumber(termfair.nmaster) or t.master_count
|
||||
local ncol = tonumber(termfair.ncol) or t.column_count
|
||||
|
||||
if num_x <= 2 then num_x = 2 end
|
||||
if ncol <= 1 then ncol = 1 end
|
||||
local width = math.floor(wa.width/num_x)
|
||||
|
||||
local num_y = math.max(math.ceil(#cls / num_x), ncol)
|
||||
local height = math.floor(wa.height/num_y)
|
||||
local cur_num_x = num_x
|
||||
|
@ -128,15 +127,6 @@ local function do_fair(p, orientation)
|
|||
-- | | | 4 | | | 3 | 5 |
|
||||
-- +---+---+---+ +---+---+---+
|
||||
|
||||
-- How many vertical columns? Read from nmaster on the tag.
|
||||
local num_x = tonumber(termfair.center.nmaster) or t.master_count
|
||||
local ncol = tonumber(termfair.center.ncol) or t.column_count
|
||||
|
||||
if num_x <= 2 then num_x = 2 end
|
||||
if ncol <= 1 then ncol = 1 end
|
||||
|
||||
local width = math.floor(wa.width / num_x)
|
||||
|
||||
if #cls < num_x then
|
||||
-- Less clients than the number of columns, let's center it!
|
||||
local offset_x = wa.x + (wa.width - #cls*width) / 2
|
||||
|
|
Loading…
Reference in New Issue