Created
December 10, 2020 21:28
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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