Use global bydirection

This commit is contained in:
Thomas Avé 2022-08-03 13:09:51 +02:00
parent a066c28b67
commit c6cac2a742
1 changed files with 1 additions and 22 deletions

View File

@ -32,28 +32,7 @@ local keys = {}
-- Move given client to given direction
local function move_client(c, direction)
-- If client is floating, move to edge
if c.floating or (awful.layout.get(mouse.screen) == awful.layout.suit.floating) then
local workarea = awful.screen.focused().workarea
if direction == "up" then
c:geometry({nil, y = workarea.y + beautiful.useless_gap * 2, nil, nil})
elseif direction == "down" then
c:geometry({nil, y = workarea.height + workarea.y - c:geometry().height - beautiful.useless_gap * 2 - beautiful.border_width * 2, nil, nil})
elseif direction == "left" then
c:geometry({x = workarea.x + beautiful.useless_gap * 2, nil, nil, nil})
elseif direction == "right" then
c:geometry({x = workarea.width + workarea.x - c:geometry().width - beautiful.useless_gap * 2 - beautiful.border_width * 2, nil, nil, nil})
end
-- Otherwise swap the client in the tiled layout
elseif awful.layout.get(mouse.screen) == awful.layout.suit.max then
if direction == "up" or direction == "left" then
awful.client.swap.byidx(-1, c)
elseif direction == "down" or direction == "right" then
awful.client.swap.byidx(1, c)
end
else
awful.client.swap.bydirection(direction, c, nil)
end
awful.client.swap.global_bydirection(direction, c, nil)
end