client: add dockable.{set/get}
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
9aeda90738
commit
0bab6e81b9
|
@ -38,6 +38,7 @@ focus = {}
|
|||
focus.history = {}
|
||||
swap = {}
|
||||
floating = {}
|
||||
dockable = {}
|
||||
property = {}
|
||||
|
||||
-- User hooks
|
||||
|
@ -767,6 +768,35 @@ function incwfact(add, c)
|
|||
capi.hooks.arrange()(t.screen)
|
||||
end
|
||||
|
||||
--- Get a client dockable state.
|
||||
-- @param c A client.
|
||||
-- @return True or false. Note that some windows might be dockable even if you
|
||||
-- did not set them manually. For example, windows with a type "utility", "toolbar"
|
||||
-- or "dock"
|
||||
function dockable.get(c)
|
||||
local value = property.get(c, "dockable")
|
||||
|
||||
-- Some sane defaults
|
||||
if value == nil then
|
||||
if (c.type == "utility" or c.type == "toolbar" or c.type == "dock") then
|
||||
value = true
|
||||
else
|
||||
value = false
|
||||
end
|
||||
end
|
||||
|
||||
return value
|
||||
end
|
||||
|
||||
--- Set a client dockable state, overriding auto-detection.
|
||||
-- With this enabled you can dock windows by moving them from the center
|
||||
-- to the edge of the workarea.
|
||||
-- @param c A client.
|
||||
-- @param value True or false.
|
||||
function dockable.set(c, value)
|
||||
property.set(c, "dockable", value)
|
||||
end
|
||||
|
||||
--- Get a client property.
|
||||
-- @param c The client.
|
||||
-- @param prop The property name.
|
||||
|
|
|
@ -117,7 +117,7 @@ function client.snap(c, snap, x, y, fixed_x, fixed_y)
|
|||
|
||||
-- Allow certain windows to snap to the edge of the workarea.
|
||||
-- Only allow docking to workarea for consistency/to avoid problems.
|
||||
if c.type == "utility" or c.type == "toolbar" or c.type == "dock" then
|
||||
if aclient.dockable.get(c) then
|
||||
local struts = c:struts()
|
||||
struts['left'] = 0
|
||||
struts['right'] = 0
|
||||
|
|
Loading…
Reference in New Issue