Skip to content

Instantly share code, notes, and snippets.

@symbioquine
Forked from alexander-yakushev/patch.lua
Last active August 11, 2019 15:40
Show Gist options
  • Save symbioquine/bd1f5ffd0ba908d3c94ca26d16a188c8 to your computer and use it in GitHub Desktop.
Save symbioquine/bd1f5ffd0ba908d3c94ca26d16a188c8 to your computer and use it in GitHub Desktop.
Fix move_to_screen in AwesomeWM v4.3
function smart_move_to_screen(c, dir)
local was_maximized = { h = false, v = false }
if c.maximized_horizontal then
c.maximized_horizontal = false
was_maximized.h = true
end
if c.maximized_vertical then
c.maximized_vertical = false
was_maximized.v = true
end
local sel = c or client.focus
if sel then
local sc = screen.count()
s = sel.screen.index + dir
if s > sc then s = 1 elseif s < 1 then s = sc end
sel:move_to_screen(s)
mouse.coords(screen[s].geometry)
end
if was_maximized.h then
c.maximized_horizontal = true
end
if was_maximized.v then
c.maximized_vertical = true
end
end
-- ........
clientkeys = awful.util.table.join(
-- ........
awful.key({ modkey, }, "o", function (c) smart_move_to_screen(c, 1) end,
{description = "move to screen", group = "client"}),
awful.key({ modkey, "Shift" }, "o", function (c) smart_move_to_screen(c, -1) end,
-- ........
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment