Add tiling shortcuts to move windows between entire screens

This commit is contained in:
Alice Gaudon 2019-09-28 12:59:41 +02:00
parent 366811bd37
commit b8aff62b38
2 changed files with 30 additions and 10 deletions

View File

@ -446,6 +446,12 @@ clientkeys = gears.table.join(-- tiling
awful.key({ config.keys.modkey, }, "Left",
tiling.key.tileLeft,
{ description = "Tile left", group = "tiling" }),
awful.key({ config.keys.modkey, "Control" }, "Right",
tiling.key.screenRight,
{ description = "Screen right", group = "tiling" }),
awful.key({ config.keys.modkey, "Control" }, "Left",
tiling.key.screenLeft,
{ description = "Screen left", group = "tiling" }),
awful.key({ config.keys.modkey, }, "Up",
tiling.key.toggleMaximized,
{ description = "Toggle maximized", group = "tiling" }),

View File

@ -32,28 +32,42 @@ local applyTile = function(c, geometry)
return not geometryEquals(initialGeometry, newGeometry)
end
local screenLeft = function(geo)
return function (c)
local newScreen = c.screen.get_next_in_direction(c.screen, "left")
if newScreen ~= nil then
c.screen = newScreen
applyTile(c, geo)
end
end
end
local screenRight = function(geo)
return function (c)
local newScreen = c.screen.get_next_in_direction(c.screen, "right")
if newScreen ~= nil then
c.screen = newScreen
applyTile(c, geo)
end
end
end
return {
key = {
tileRight = function (c)
c.maximized = true
if not applyTile(c, rightTileGeometry) then
local newScreen = c.screen.get_next_in_direction(c.screen, "right")
if newScreen ~= nil then
c.screen = newScreen
applyTile(c, leftTileGeometry)
end
screenRight(leftTileGeometry)(c)
end
end,
tileLeft = function (c)
c.maximized = true
if not applyTile(c, leftTileGeometry) then
local newScreen = c.screen.get_next_in_direction(c.screen, "left")
if newScreen ~= nil then
c.screen = newScreen
applyTile(c, rightTileGeometry)
end
screenLeft(rightTileGeometry)(c)
end
end,
screenLeft = screenLeft(maximizedTileGeometry),
screenRight = screenRight(maximizedTileGeometry),
toggleMaximized = function (c)
if not c.maximized then
c.maximized = true