commit
19e57cd29b
|
@ -9,6 +9,7 @@ All documentation, instructions, and previews are [here](https://nooo37.github.i
|
|||
- centered
|
||||
- vertical
|
||||
- horizontal
|
||||
- equalarea
|
||||
- Modules
|
||||
- Flash Focus
|
||||
- Tabbed container
|
||||
|
|
|
@ -11,6 +11,7 @@ bling.layout.mstab
|
|||
bling.layout.centered
|
||||
bling.layout.vertical
|
||||
bling.layout.horizontal
|
||||
bling.layout.equalarea
|
||||
```
|
||||
|
||||
### Theme Variables
|
||||
|
@ -42,3 +43,8 @@ theme.mstab_tabbar_style = "default" -- style of the tabbar ("default", "
|
|||
![](https://media.discordapp.net/attachments/769673106842845194/780095998239834142/unknown.png)
|
||||
|
||||
*screenshot by [branwright](https://github.com/branwright1)*
|
||||
|
||||
#### Equal area
|
||||
![](https://imgur.com/a/qt3qxyT)
|
||||
|
||||
*screenshot by [bysmutheye](https://github.com/bysmutheye)*
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
|
@ -0,0 +1,84 @@
|
|||
local gears = require("gears")
|
||||
local gcolor = require("gears.color")
|
||||
local beautiful = require("beautiful")
|
||||
local math = math
|
||||
local screen = screen
|
||||
local mylayout = {}
|
||||
mylayout.name = "equalarea"
|
||||
|
||||
local function divide(p,g,low,high,cls,mwfact,mcount)
|
||||
if low == high then
|
||||
p.geometries[cls[low]] = g
|
||||
else
|
||||
local masters = math.max(0,math.min(mcount,high)-low+1)
|
||||
local numblock = high-low + 1
|
||||
local slaves = numblock - masters
|
||||
local smalldiv
|
||||
if numblock > 5 and (numblock % 5) == 0 then
|
||||
smalldiv = math.floor(numblock/5)
|
||||
else
|
||||
if (numblock % 3) == 0 then
|
||||
smalldiv = math.floor(numblock/3)
|
||||
else
|
||||
smalldiv = math.floor(numblock/2)
|
||||
end
|
||||
end
|
||||
local bigdiv = numblock - smalldiv
|
||||
local smallmasters = math.min(masters,smalldiv)
|
||||
local bigmasters = masters-smallmasters
|
||||
local smallg = {}
|
||||
local bigg = {}
|
||||
smallg.x = g.x
|
||||
smallg.y = g.y
|
||||
if g.width > (g.height*1.3) then
|
||||
smallg.height = g.height
|
||||
bigg.height = g.height
|
||||
bigg.width = math.floor(g.width*(bigmasters*(mwfact-1)+bigdiv)/(slaves+mwfact*masters))
|
||||
smallg.width = g.width-bigg.width
|
||||
bigg.y = g.y
|
||||
bigg.x = g.x + smallg.width
|
||||
else
|
||||
smallg.width = g.width
|
||||
bigg.width = g.width
|
||||
bigg.height = math.floor(g.height*(bigmasters*(mwfact-1)+bigdiv)/(slaves+mwfact*masters))
|
||||
smallg.height = g.height-bigg.height
|
||||
bigg.x = g.x
|
||||
bigg.y = g.y + smallg.height
|
||||
end
|
||||
divide(p,smallg,low,high-bigdiv,cls,mwfact,mcount)
|
||||
divide(p,bigg,low+smalldiv,high,cls,mwfact,mcount)
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
function mylayout.arrange(p)
|
||||
local t = p.tag or screen[p.screen].selected_tag
|
||||
local wa = p.workarea
|
||||
local cls = p.clients
|
||||
|
||||
if #cls == 0 then return end
|
||||
local mwfact = t.master_width_factor*2
|
||||
local mcount = t.master_count
|
||||
local g = {}
|
||||
g.height = wa.height
|
||||
g.width = wa.width
|
||||
g.x = wa.x
|
||||
g.y = wa.y
|
||||
divide(p,g,1,#cls,cls,mwfact,mcount)
|
||||
end
|
||||
|
||||
local icon_raw = gears.filesystem.get_configuration_dir() .. tostring(...):match("^.*bling"):gsub("%.", "/") .. "/icons/layouts/equalarea.png"
|
||||
|
||||
local function get_icon()
|
||||
if icon_raw ~= nil then
|
||||
return gcolor.recolor_image(icon_raw, beautiful.fg_normal)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
layout = mylayout,
|
||||
icon_raw = icon_raw,
|
||||
get_icon = get_icon,
|
||||
}
|
|
@ -12,11 +12,15 @@ beautiful.layout_horizontal = horizontal.get_icon()
|
|||
local centered = require(... .. ".centered")
|
||||
beautiful.layout_centered = centered.get_icon()
|
||||
|
||||
local equalarea = require(... .. ".equalarea")
|
||||
beautiful.layout_equalarea = equalarea.get_icon()
|
||||
|
||||
local layout = {
|
||||
mstab = mstab.layout,
|
||||
centered = centered.layout,
|
||||
vertical = vertical.layout,
|
||||
horizontal = horizontal.layout
|
||||
horizontal = horizontal.layout,
|
||||
equalarea = equalarea.layout
|
||||
}
|
||||
|
||||
return layout
|
||||
|
|
Loading…
Reference in New Issue