-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixedw.lua
42 lines (34 loc) · 948 Bytes
/
fixedw.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
local ipairs = ipairs
local math = math
local tag = require("awful.tag")
module("fixedw")
local function fixedw(p, fixed_width)
local wa = p.workarea
local cls = p.clients
local max_fixed = math.floor(wa.width / fixed_width)
local remainder_width = wa.width - max_fixed*fixed_width
local remainder_height = wa.height / (#cls - max_fixed)
for k, c in ipairs(cls) do
local g = {}
if (k <= max_fixed) then
g.width = fixed_width
g.height = wa.height
g.x = wa.x + (k-1) * fixed_width
g.y = wa.y
else
g.width = remainder_width
g.height = remainder_height
g.x = wa.x + max_fixed * fixed_width
g.y = wa.y + (k - max_fixed - 1) * remainder_height
end
c:geometry(g)
end
end
name = "fixedw"
function arrange(p)
--local w = p.workarea.width
--local f = tag.getmwfact(tag.selected(p.screen))
--return fixedw(p, w*f)
-- "xwininfo -size" on an xterm "x resize increment" is 6
return fixedw(p, 85 * 6 + 2)
end