From a535cede1e8393a87f1979f712e30a564f608623 Mon Sep 17 00:00:00 2001 From: elenapan Date: Wed, 11 Mar 2020 01:16:34 +0200 Subject: [PATCH] Refactor helpers.float_and_edge_snap Also now it respects beautiful.useless_gap --- config/awesome/helpers.lua | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/config/awesome/helpers.lua b/config/awesome/helpers.lua index b560119..9522411 100644 --- a/config/awesome/helpers.lua +++ b/config/awesome/helpers.lua @@ -249,38 +249,36 @@ function helpers.move_client_dwim(c, direction) end -- Make client floating and snap to the desired edge +-- Respects gaps +-- TODO needs work function helpers.float_and_edge_snap(c, direction) - -- if not c.floating then - -- c.floating = true - -- end - naughty.notify({ text = "double tap"}) + c.maximized = false c.floating = true local workarea = awful.screen.focused().workarea + local f if direction == "up" then local axis = 'horizontally' - local f = awful.placement.scale + f = awful.placement.scale + awful.placement.top + (axis and awful.placement['maximize_'..axis] or nil) - local geo = f(client.focus, {honor_padding = true, honor_workarea=true, to_percent = 0.5}) elseif direction == "down" then local axis = 'horizontally' - local f = awful.placement.scale + f = awful.placement.scale + awful.placement.bottom + (axis and awful.placement['maximize_'..axis] or nil) - local geo = f(client.focus, {honor_padding = true, honor_workarea=true, to_percent = 0.5}) elseif direction == "left" then local axis = 'vertically' - local f = awful.placement.scale + f = awful.placement.scale + awful.placement.left + (axis and awful.placement['maximize_'..axis] or nil) - local geo = f(client.focus, {honor_padding = true, honor_workarea=true, to_percent = 0.5}) elseif direction == "right" then local axis = 'vertically' - local f = awful.placement.scale + f = awful.placement.scale + awful.placement.right + (axis and awful.placement['maximize_'..axis] or nil) - local geo = f(client.focus, {honor_padding = true, honor_workarea=true, to_percent = 0.5}) end + -- TODO gap should be different depending on position + f(client.focus, {honor_padding = true, honor_workarea=true, to_percent = 0.5, margins = beautiful.useless_gap * 2 }) end -- Rounds a number to any number of decimals