Merge branch 'Veratil-awesome-v4-layout-fix'

This commit is contained in:
copycat-killer 2017-01-25 19:48:45 +01:00
commit 176f4d75e1
3 changed files with 24 additions and 14 deletions

View File

@ -8,7 +8,7 @@
--]] --]]
local tag = require("awful.tag") local scr = require("awful.screen")
local tonumber = tonumber local tonumber = tonumber
local cascade = { local cascade = {
@ -31,6 +31,9 @@ local function do_cascade(p, tiling)
-- Screen. -- Screen.
local wa = p.workarea local wa = p.workarea
local cls = p.clients local cls = p.clients
local ta = scr.focused().selected_tag
if not ta then return end
if #cls <= 0 then return end if #cls <= 0 then return end
@ -44,7 +47,7 @@ local function do_cascade(p, tiling)
if cascade.nmaster > 0 then if cascade.nmaster > 0 then
num_c = cascade.nmaster num_c = cascade.nmaster
else else
num_c = tag.master_count num_c = ta.master_count
end end
-- Opening a new window will usually force all existing windows to -- Opening a new window will usually force all existing windows to
@ -89,7 +92,7 @@ local function do_cascade(p, tiling)
if cascade.tile.mwfact > 0 then if cascade.tile.mwfact > 0 then
mwfact = cascade.tile.mwfact mwfact = cascade.tile.mwfact
else else
mwfact = tag.getmwfact(t) mwfact = ta.master_width_factor
end end
-- Make slave windows overlap main window? Do this if ncol is 1. -- Make slave windows overlap main window? Do this if ncol is 1.
@ -97,7 +100,7 @@ local function do_cascade(p, tiling)
if cascade.tile.ncol > 0 then if cascade.tile.ncol > 0 then
overlap_main = cascade.tile.ncol overlap_main = cascade.tile.ncol
else else
overlap_main = tag.column_count overlap_main = ta.column_count
end end
-- Minimum space for slave windows? See cascade.tile.lua. -- Minimum space for slave windows? See cascade.tile.lua.
@ -105,7 +108,7 @@ local function do_cascade(p, tiling)
if cascade.tile.nmaster > 0 then if cascade.tile.nmaster > 0 then
num_c = cascade.tile.nmaster num_c = cascade.tile.nmaster
else else
num_c = tag.master_count num_c = ta.master_count
end end
local how_many = (#cls - 1 >= num_c and (#cls - 1)) or num_c local how_many = (#cls - 1 >= num_c and (#cls - 1)) or num_c

View File

@ -10,9 +10,9 @@
--]] --]]
local tag = require("awful.tag")
local tonumber = tonumber local tonumber = tonumber
local math = { floor = math.floor } local math = { floor = math.floor }
local scr = require("awful.screen")
local centerwork = { local centerwork = {
name = "centerwork", name = "centerwork",
@ -23,6 +23,9 @@ local function do_centerwork(p, orientation)
-- Screen. -- Screen.
local wa = p.workarea local wa = p.workarea
local cls = p.clients local cls = p.clients
local ta = scr.focused().selected_tag
if not ta then return end
if #cls <= 0 then return end if #cls <= 0 then return end
@ -33,7 +36,7 @@ local function do_centerwork(p, orientation)
local g = {} local g = {}
-- Main column, fixed width and height. -- Main column, fixed width and height.
local mwfact = tag.object.get_master_width_factor(t) local mwfact = ta.master_width_factor
local mainhei = math.floor(wa.height * mwfact) local mainhei = math.floor(wa.height * mwfact)
local mainwid = math.floor(wa.width * mwfact) local mainwid = math.floor(wa.width * mwfact)
local slavewid = wa.width - mainwid local slavewid = wa.width - mainwid

View File

@ -9,7 +9,7 @@
--]] --]]
local tag = require("awful.tag") local scr = require("awful.screen")
local math = { ceil = math.ceil, local math = { ceil = math.ceil,
floor = math.floor, floor = math.floor,
max = math.max } max = math.max }
@ -22,6 +22,9 @@ local function do_fair(p, orientation)
-- Screen. -- Screen.
local wa = p.workarea local wa = p.workarea
local cls = p.clients local cls = p.clients
local ta = scr.focused().selected_tag
if not ta then return end
if #cls <= 0 then return end if #cls <= 0 then return end
@ -50,12 +53,12 @@ local function do_fair(p, orientation)
if #cls <= 0 then return end if #cls <= 0 then return end
-- How many vertical columns? Read from nmaster on the tag. -- How many vertical columns? Read from nmaster on the tag.
local num_x = tonumber(termfair.nmaster) or tag.master_count local num_x = tonumber(termfair.nmaster) or ta.master_count
local ncol = tonumber(termfair.ncol) or tag.column_count local ncol = tonumber(termfair.ncol) or ta.column_count
local width = math.floor((wa.width - (num_x + 1)*useless_gap) / num_x)
if num_x <= 2 then num_x = 2 end if num_x <= 2 then num_x = 2 end
if ncol <= 1 then ncol = 1 end if ncol <= 1 then ncol = 1 end
local width = math.floor((wa.width - (num_x + 1)*useless_gap) / num_x)
local num_y = math.max(math.ceil(#cls / num_x), ncol) local num_y = math.max(math.ceil(#cls / num_x), ncol)
local height = math.floor((wa.height - (num_y + 1)*useless_gap) / num_y) local height = math.floor((wa.height - (num_y + 1)*useless_gap) / num_y)
@ -143,13 +146,14 @@ local function do_fair(p, orientation)
-- +---+---+---+ +---+---+---+ -- +---+---+---+ +---+---+---+
-- How many vertical columns? Read from nmaster on the tag. -- How many vertical columns? Read from nmaster on the tag.
local num_x = tonumber(termfair.center.nmaster) or tag.master_count local num_x = tonumber(termfair.center.nmaster) or ta.master_count
local ncol = tonumber(termfair.center.ncol) or tag.column_count local ncol = tonumber(termfair.center.ncol) or ta.column_count
local width = math.floor((wa.width - (num_x + 1)*useless_gap) / num_x)
if num_x <= 2 then num_x = 2 end if num_x <= 2 then num_x = 2 end
if ncol <= 1 then ncol = 1 end if ncol <= 1 then ncol = 1 end
local width = math.floor((wa.width - (num_x + 1)*useless_gap) / num_x)
if #cls < num_x then if #cls < num_x then
-- Less clients than the number of columns, let's center it! -- Less clients than the number of columns, let's center it!
local offset_x = wa.x + (wa.width - #cls*width - (#cls - 1)*useless_gap) / 2 local offset_x = wa.x + (wa.width - #cls*width - (#cls - 1)*useless_gap) / 2