commit
d51a647003
|
@ -10,14 +10,15 @@
|
||||||
-- Grab environment we need
|
-- Grab environment we need
|
||||||
local ipairs = ipairs
|
local ipairs = ipairs
|
||||||
local type = type
|
local type = type
|
||||||
local tag = require("awful.tag")
|
|
||||||
local util = require("awful.util")
|
local util = require("awful.util")
|
||||||
local ascreen = require("awful.screen")
|
local ascreen = require("awful.screen")
|
||||||
local capi = {
|
local capi = {
|
||||||
screen = screen,
|
screen = screen,
|
||||||
awesome = awesome,
|
awesome = awesome,
|
||||||
client = client
|
client = client,
|
||||||
|
tag = tag
|
||||||
}
|
}
|
||||||
|
local tag = require("awful.tag")
|
||||||
local client = require("awful.client")
|
local client = require("awful.client")
|
||||||
local timer = require("gears.timer")
|
local timer = require("gears.timer")
|
||||||
|
|
||||||
|
@ -120,22 +121,26 @@ function layout.arrange(screen)
|
||||||
|
|
||||||
local p = {}
|
local p = {}
|
||||||
p.workarea = capi.screen[screen].workarea
|
p.workarea = capi.screen[screen].workarea
|
||||||
|
local useless_gap = tag.getgap(tag.selected(screen))
|
||||||
-- Handle padding
|
-- Handle padding
|
||||||
local padding = ascreen.padding(capi.screen[screen])
|
local padding = ascreen.padding(capi.screen[screen]) or {}
|
||||||
if padding then
|
p.workarea.x = p.workarea.x + (padding.left or 0) + useless_gap
|
||||||
p.workarea.x = p.workarea.x + (padding.left or 0)
|
p.workarea.y = p.workarea.y + (padding.top or 0) + useless_gap
|
||||||
p.workarea.y = p.workarea.y + (padding.top or 0)
|
p.workarea.width = p.workarea.width - ((padding.left or 0 ) +
|
||||||
p.workarea.width = p.workarea.width - ((padding.left or 0 ) + (padding.right or 0))
|
(padding.right or 0) + useless_gap * 2)
|
||||||
p.workarea.height = p.workarea.height - ((padding.top or 0) + (padding.bottom or 0))
|
p.workarea.height = p.workarea.height - ((padding.top or 0) +
|
||||||
end
|
(padding.bottom or 0) + useless_gap * 2)
|
||||||
|
|
||||||
p.geometry = capi.screen[screen].geometry
|
p.geometry = capi.screen[screen].geometry
|
||||||
p.clients = client.tiled(screen)
|
p.clients = client.tiled(screen)
|
||||||
p.screen = screen
|
p.screen = screen
|
||||||
p.geometries = setmetatable({}, {__mode = "k"})
|
p.geometries = setmetatable({}, {__mode = "k"})
|
||||||
layout.get(screen).arrange(p)
|
layout.get(screen).arrange(p)
|
||||||
for c, g in pairs(p.geometries) do
|
for c, g in pairs(p.geometries) do
|
||||||
g.width = g.width - c.border_width * 2
|
g.width = g.width - c.border_width * 2 - useless_gap * 2
|
||||||
g.height = g.height - c.border_width * 2
|
g.height = g.height - c.border_width * 2 - useless_gap * 2
|
||||||
|
g.x = g.x + useless_gap
|
||||||
|
g.y = g.y + useless_gap
|
||||||
c:geometry(g)
|
c:geometry(g)
|
||||||
end
|
end
|
||||||
capi.screen[screen]:emit_signal("arrange")
|
capi.screen[screen]:emit_signal("arrange")
|
||||||
|
@ -173,31 +178,23 @@ capi.client.connect_signal("property::screen", function(c, old_screen)
|
||||||
layout.arrange(c.screen)
|
layout.arrange(c.screen)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function arrange_on_tagged(c, tag)
|
|
||||||
if not tag.screen then return end
|
|
||||||
layout.arrange(tag.screen)
|
|
||||||
if not capi.client.focus or not capi.client.focus:isvisible() then
|
|
||||||
local c = client.focus.history.get(tag.screen, 0)
|
|
||||||
if c then
|
|
||||||
c:emit_signal("request::activate", "layout.arrange_on_tagged",
|
|
||||||
{raise=false})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local function arrange_tag(t)
|
local function arrange_tag(t)
|
||||||
layout.arrange(tag.getscreen(t))
|
layout.arrange(tag.getscreen(t))
|
||||||
end
|
end
|
||||||
|
|
||||||
capi.screen.add_signal("arrange")
|
capi.screen.add_signal("arrange")
|
||||||
|
|
||||||
|
capi.tag.connect_signal("property::mwfact", arrange_tag)
|
||||||
|
capi.tag.connect_signal("property::nmaster", arrange_tag)
|
||||||
|
capi.tag.connect_signal("property::ncol", arrange_tag)
|
||||||
|
capi.tag.connect_signal("property::layout", arrange_tag)
|
||||||
|
capi.tag.connect_signal("property::windowfact", arrange_tag)
|
||||||
|
capi.tag.connect_signal("property::selected", arrange_tag)
|
||||||
|
capi.tag.connect_signal("property::activated", arrange_tag)
|
||||||
|
capi.tag.connect_signal("property::useless_gap", arrange_tag)
|
||||||
|
capi.tag.connect_signal("tagged", arrange_tag)
|
||||||
|
|
||||||
for s = 1, capi.screen.count() do
|
for s = 1, capi.screen.count() do
|
||||||
tag.attached_connect_signal(s, "property::mwfact", arrange_tag)
|
|
||||||
tag.attached_connect_signal(s, "property::nmaster", arrange_tag)
|
|
||||||
tag.attached_connect_signal(s, "property::ncol", arrange_tag)
|
|
||||||
tag.attached_connect_signal(s, "property::layout", arrange_tag)
|
|
||||||
tag.attached_connect_signal(s, "property::windowfact", arrange_tag)
|
|
||||||
tag.attached_connect_signal(s, "property::selected", arrange_tag)
|
|
||||||
tag.attached_connect_signal(s, "property::activated", arrange_tag)
|
|
||||||
tag.attached_connect_signal(s, "tagged", arrange_tag)
|
|
||||||
capi.screen[s]:connect_signal("property::workarea", function(screen)
|
capi.screen[s]:connect_signal("property::workarea", function(screen)
|
||||||
layout.arrange(screen.index)
|
layout.arrange(screen.index)
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
-- Grab environment we need
|
-- Grab environment we need
|
||||||
local util = require("awful.util")
|
local util = require("awful.util")
|
||||||
local timer = require("gears.timer")
|
local timer = require("gears.timer")
|
||||||
|
local beautiful = require("beautiful")
|
||||||
local tostring = tostring
|
local tostring = tostring
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local ipairs = ipairs
|
local ipairs = ipairs
|
||||||
|
@ -383,6 +384,30 @@ function tag.getmwfact(t)
|
||||||
return tag.getproperty(t, "mwfact") or 0.5
|
return tag.getproperty(t, "mwfact") or 0.5
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set the spacing between clients
|
||||||
|
-- @param useless_gap The spacing between clients
|
||||||
|
-- @param t The tag to modify, if null tag.selected() is used.
|
||||||
|
function tag.setgap(useless_gap, t)
|
||||||
|
local t = t or tag.selected()
|
||||||
|
if useless_gap >= 0 then
|
||||||
|
tag.setproperty(t, "useless_gap", useless_gap)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Increase the spacing between clients
|
||||||
|
-- @param add Value to add to the spacing between clients
|
||||||
|
-- @param t The tag to modify, if null tag.selected() is used.
|
||||||
|
function tag.incgap(add, t)
|
||||||
|
tag.setgap(tag.getgap(t) + add, t)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get the spacing between clients
|
||||||
|
-- @param t Optional tag.
|
||||||
|
function tag.getgap(t)
|
||||||
|
local t = t or tag.selected()
|
||||||
|
return tag.getproperty(t, "useless_gap") or beautiful.useless_gap or 0
|
||||||
|
end
|
||||||
|
|
||||||
--- Set the number of master windows.
|
--- Set the number of master windows.
|
||||||
-- @param nmaster The number of master windows.
|
-- @param nmaster The number of master windows.
|
||||||
-- @param[opt] t The tag.
|
-- @param[opt] t The tag.
|
||||||
|
@ -673,6 +698,7 @@ capi.tag.add_signal("property::icon")
|
||||||
capi.tag.add_signal("property::icon_only")
|
capi.tag.add_signal("property::icon_only")
|
||||||
capi.tag.add_signal("property::layout")
|
capi.tag.add_signal("property::layout")
|
||||||
capi.tag.add_signal("property::mwfact")
|
capi.tag.add_signal("property::mwfact")
|
||||||
|
capi.tag.add_signal("property::useless_gap")
|
||||||
capi.tag.add_signal("property::ncol")
|
capi.tag.add_signal("property::ncol")
|
||||||
capi.tag.add_signal("property::nmaster")
|
capi.tag.add_signal("property::nmaster")
|
||||||
capi.tag.add_signal("property::windowfact")
|
capi.tag.add_signal("property::windowfact")
|
||||||
|
|
|
@ -17,6 +17,7 @@ theme.fg_focus = "#ffffff"
|
||||||
theme.fg_urgent = "#ffffff"
|
theme.fg_urgent = "#ffffff"
|
||||||
theme.fg_minimize = "#ffffff"
|
theme.fg_minimize = "#ffffff"
|
||||||
|
|
||||||
|
theme.useless_gap = 0
|
||||||
theme.border_width = 1
|
theme.border_width = 1
|
||||||
theme.border_normal = "#000000"
|
theme.border_normal = "#000000"
|
||||||
theme.border_focus = "#535d6c"
|
theme.border_focus = "#535d6c"
|
||||||
|
|
|
@ -19,6 +19,7 @@ theme.fg_focus = "#2e3436"
|
||||||
theme.fg_urgent = "#2e3436"
|
theme.fg_urgent = "#2e3436"
|
||||||
theme.fg_minimize = "#2e3436"
|
theme.fg_minimize = "#2e3436"
|
||||||
|
|
||||||
|
theme.useless_gap = 0
|
||||||
theme.border_width = 2
|
theme.border_width = 2
|
||||||
theme.border_normal = "#dae3e0"
|
theme.border_normal = "#dae3e0"
|
||||||
theme.border_focus = "#729fcf"
|
theme.border_focus = "#729fcf"
|
||||||
|
|
|
@ -22,6 +22,7 @@ theme.fg_focus = theme.bg_normal
|
||||||
theme.fg_urgent = theme.bg_normal
|
theme.fg_urgent = theme.bg_normal
|
||||||
theme.fg_minimize = theme.bg_normal
|
theme.fg_minimize = theme.bg_normal
|
||||||
|
|
||||||
|
theme.useless_gap = dpi(5)
|
||||||
theme.border_width = dpi(1)
|
theme.border_width = dpi(1)
|
||||||
theme.border_normal = xrdb.color0
|
theme.border_normal = xrdb.color0
|
||||||
theme.border_focus = theme.bg_focus
|
theme.border_focus = theme.bg_focus
|
||||||
|
|
|
@ -25,6 +25,7 @@ theme.bg_systray = theme.bg_normal
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Borders
|
-- {{{ Borders
|
||||||
|
theme.useless_gap = 0
|
||||||
theme.border_width = 2
|
theme.border_width = 2
|
||||||
theme.border_normal = "#3F3F3F"
|
theme.border_normal = "#3F3F3F"
|
||||||
theme.border_focus = "#6F6F6F"
|
theme.border_focus = "#6F6F6F"
|
||||||
|
|
Loading…
Reference in New Issue