Skip to content

Instantly share code, notes, and snippets.

@mipmip
Created December 10, 2020 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mipmip/c868d2a69b43291111a98fbaeee21921 to your computer and use it in GitHub Desktop.
Save mipmip/c868d2a69b43291111a98fbaeee21921 to your computer and use it in GitHub Desktop.
AwesomeWM config fragment: Jump to previous/next screen when last left/right client
-- begin extract
awful.key({modkey}, "Left",
function()
focus_next_horizontal_client("left")
end,
{description = "focus left", group = "client"}
),
awful.key({modkey}, "Right",
function()
focus_next_horizontal_client("right")
end,
{description = "focus right", group = "client"}
),
-- end extract
local function focus_next_horizontal_client(direction)
local current_client = client.focus
awful.client.focus.bydirection(direction)
local new_client = client.focus
if current_client == new_client then
if direction == "left" then
awful.screen.focus_relative(-1)
else
awful.screen.focus_relative(1)
end
else
raise_client()
end
end
-- raise focused client
local function raise_client()
if client.focus then
client.focus:raise()
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment