Skip to content

Commit

Permalink
modkey-tab optional cycle between instead of two-history-swapping; cl…
Browse files Browse the repository at this point in the history
…oses #274
  • Loading branch information
Luca CPZ committed Nov 26, 2019
1 parent 99988d7 commit 06f05ac
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions rc.lua.template
Expand Up @@ -91,6 +91,7 @@ local modkey = "Mod4"
local altkey = "Mod1"
local terminal = "urxvtc"
local vi_focus = false -- vi-like client focus - https://github.com/lcpz/awesome-copycats/issues/275
local cycle_prev = true -- cycle trough all previous client or just the first -- https://github.com/lcpz/awesome-copycats/issues/274
local editor = os.getenv("EDITOR") or "vim"
local gui_editor = os.getenv("GUI_EDITOR") or "gvim"
local browser = os.getenv("BROWSER") or "firefox"
Expand Down Expand Up @@ -334,12 +335,26 @@ globalkeys = my_table.join(
{description = "jump to urgent client", group = "client"}),
awful.key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if cycle_prev then
awful.client.focus.history.previous()
else
awful.client.focus.byidx(-1)
end
if client.focus then
client.focus:raise()
end
end,
{description = "go back", group = "client"}),
{description = "cycle with previous/go back", group = "client"}),
awful.key({ modkey, "Shift" }, "Tab",
function ()
if cycle_prev then
awful.client.focus.byidx(1)
if client.focus then
client.focus:raise()
end
end
end,
{description = "go forth", group = "client"}),

-- Show/Hide Wibox
awful.key({ modkey }, "b", function ()
Expand Down

1 comment on commit 06f05ac

@Konfekt
Copy link
Contributor

@Konfekt Konfekt commented on 06f05ac Feb 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of binding Shift-Tab unconditionally, would not be cleaner:

if not cycle_prev then
    globalkeys = awful.util.table.join(globalkeys,
        awful.key({ modkey, "Shift"   }, "Tab",
            function ()
                awful.client.focus.byidx(1)
                if client.focus then
                  client.focus:raise()
                end
            end,
            {description = "go forth", group = "client"})
    )
end

Please sign in to comment.