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", awful.key({ config.keys.modkey, }, "Left",
tiling.key.tileLeft, tiling.key.tileLeft,
{ description = "Tile left", group = "tiling" }), { 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", awful.key({ config.keys.modkey, }, "Up",
tiling.key.toggleMaximized, tiling.key.toggleMaximized,
{ description = "Toggle maximized", group = "tiling" }), { description = "Toggle maximized", group = "tiling" }),

View File

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