mirror of
https://github.com/elenapan/dotfiles.git
synced 2026-01-10 11:12:37 +08:00
Refactor helpers.float_and_edge_snap
Also now it respects beautiful.useless_gap
This commit is contained in:
parent
96daf9e29a
commit
a535cede1e
1 changed files with 10 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue