added icon and necessary code

This commit is contained in:
bysmuth 2021-03-03 12:24:56 +01:00
parent 5bcb519e75
commit 59fdd00caa
4 changed files with 26 additions and 7 deletions

View File

@ -43,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)*

BIN
icons/layouts/equalarea.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -1,7 +1,11 @@
local gears = require("gears")
local gcolor = require("gears.color")
local beautiful = require("beautiful")
local math = math
local screen = screen
local tonumber = tonumber
local equalarea = {name = "equalarea"}
local mylayout = {}
mylayout.name = "equalarea"
local function divide(p,g,low,high,cls,mwfact,mcount)
if low == high then
p.geometries[cls[low]] = g
@ -47,7 +51,7 @@ local function divide(p,g,low,high,cls,mwfact,mcount)
return
end
local function arrange(p)
function mylayout.arrange(p)
local t = p.tag or screen[p.screen].selected_tag
local wa = p.workarea
local cls = p.clients
@ -63,8 +67,18 @@ local function arrange(p)
divide(p,g,1,#cls,cls,mwfact,mcount)
end
function equalarea.arrange(p)
return arrange(p)
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 = equalarea}
return {
layout = mylayout,
icon_raw = icon_raw,
get_icon = get_icon,
}

View File

@ -13,8 +13,8 @@ local centered = require(... .. ".centered")
beautiful.layout_centered = centered.get_icon()
local equalarea = require(... .. ".equalarea")
beautiful.layout_equalarea = equalarea.get_icon()
beautiful.layout_centered = centered.get_icon()
local layout = {
mstab = mstab.layout,
centered = centered.layout,