Move Window to Workspace Left/Right
While the default rc.lua configuration file includes keyboard shortcuts to move the focused window to an enumerated tag, an alternate way to move windows between tags is to shift them one tag to the left or right. The following keybinding functions will perform this task, moving the focused window one workspace to the left or right (and wrapping at the edges).
awful.key({ modkey, "Shift" }, ",",
function (c)
local curidx = awful.tag.getidx(c:tags()[1])
if curidx == 1 then
c:tags({screen[mouse.screen]:tags()[9]})
else
c:tags({screen[mouse.screen]:tags()[curidx - 1]})
end
end),
awful.key({ modkey, "Shift" }, ".",
function (c)
local curidx = awful.tag.getidx(c:tags()[1])
if curidx == 9 then
c:tags({screen[mouse.screen]:tags()[1]})
else
c:tags({screen[mouse.screen]:tags()[curidx + 1]})
end
end)
This script assumes there are exactly 9 tags per screen, each with a distinct index value. If the focused window has more than one tag, it will be moved to the left/right of the leftmost tag, and lose any other tags it has. The keybindings are "mod4+shift+," and "mod4+shift+." because these are the < and > keys on most keyboards.
These functions must be placed in the clientkeys table.