diff --git a/lib/awful/client.lua.in b/lib/awful/client.lua.in index b3827ff66..35f7ceab8 100644 --- a/lib/awful/client.lua.in +++ b/lib/awful/client.lua.in @@ -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. diff --git a/lib/awful/mouse.lua.in b/lib/awful/mouse.lua.in index e12260440..9d1a2b819 100644 --- a/lib/awful/mouse.lua.in +++ b/lib/awful/mouse.lua.in @@ -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