Skip to content

Instantly share code, notes, and snippets.

@appuchias
Last active June 25, 2022 23:03
Show Gist options
  • Save appuchias/6a900e765bf709f75b64ef620eca2772 to your computer and use it in GitHub Desktop.
Save appuchias/6a900e765bf709f75b64ef620eca2772 to your computer and use it in GitHub Desktop.
AwesomeWM hotkey to move client to next/prev tag
-- Original post: https://www.reddit.com/r/awesomewm/comments/7cfef6/comment/dt0c0c3/?utm_source=share&utm_medium=web2x&context=3
-- This should be included in globalkeys (or the variable used in root.keys(variable))
-- Win+Alt+Left/Right: move client to prev/next tag and switch to it
awful.key({ modkey, "Mod1" }, "Left",
function ()
-- get current tag
local t = client.focus and client.focus.first_tag or nil
if t == nil then
return
end
-- get previous tag (modulo 9 excluding 0 to wrap from 1 to 9)
local tag = client.focus.screen.tags[(t.index - 2) % 9 + 1]
awful.client.movetotag(tag)
awful.tag.viewprev()
end,
{description = "move client to previous tag and switch to it", group = "layout"}),
awful.key({ modkey, "Mod1" }, "Right",
function ()
-- get current tag
local t = client.focus and client.focus.first_tag or nil
if t == nil then
return
end
-- get next tag (modulo 9 excluding 0 to wrap from 9 to 1)
local tag = client.focus.screen.tags[(t.index % 9) + 1]
awful.client.movetotag(tag)
awful.tag.viewnext()
end,
{description = "move client to next tag and switch to it", group = "layout"}),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment