modify alt-tab behaviour
This commit is contained in:
parent
e36f3889d8
commit
52d8678aac
|
@ -307,15 +307,70 @@ keys.globalkeys = gears.table.join(
|
|||
-- Focus client by index (cycle through clients)
|
||||
awful.key({modkey}, "Tab",
|
||||
function()
|
||||
awful.client.focus.byidx(1)
|
||||
local screen = awful.screen.focused()
|
||||
local tags = screen.tags
|
||||
local current_tag = screen.selected_tag
|
||||
local used_tags = {}
|
||||
for _, t in ipairs(tags) do
|
||||
if t == current_tag or #t:clients() > 0 then
|
||||
table.insert(used_tags, t)
|
||||
end
|
||||
end
|
||||
local found = false
|
||||
for _, t in ipairs(used_tags) do
|
||||
if found then
|
||||
t:view_only()
|
||||
return
|
||||
elseif t == current_tag then
|
||||
found = true
|
||||
end
|
||||
end
|
||||
used_tags[1]:view_only()
|
||||
end,
|
||||
{description = "focus next by index", group = "client"}
|
||||
{description = "Switch to next tag", group = "client"}
|
||||
),
|
||||
awful.key({modkey, "Shift"}, "Tab",
|
||||
function()
|
||||
awful.client.focus.byidx(-1)
|
||||
local tags = root.tags()
|
||||
local current_tag = awful.screen.focused().selected_tag
|
||||
local used_tags = {}
|
||||
for _, t in ipairs(tags) do
|
||||
if t == current_tag or #t:clients() > 0 then
|
||||
table.insert(used_tags, t)
|
||||
end
|
||||
end
|
||||
local found = false
|
||||
for _, t in ipairs(used_tags) do
|
||||
if found then
|
||||
awful.screen.focus(t.screen.index)
|
||||
t:view_only()
|
||||
return
|
||||
elseif t == current_tag then
|
||||
found = true
|
||||
end
|
||||
end
|
||||
used_tags[1]:view_only()
|
||||
end,
|
||||
{description = "focus previous by index", group = "client"}
|
||||
{description = "Switch to next tag", group = "client"}
|
||||
),
|
||||
-- Focus client by index (cycle through clients)
|
||||
awful.key({modkey}, "t",
|
||||
function()
|
||||
local screen = awful.screen.focused()
|
||||
local tags = screen.tags
|
||||
local first_empty = nil
|
||||
for _, t in ipairs(tags) do
|
||||
if #t:clients() > 0 then
|
||||
first_empty = nil
|
||||
elseif first_empty == nil then
|
||||
first_empty = t
|
||||
end
|
||||
end
|
||||
if first_empty ~= nil then
|
||||
first_empty:view_only()
|
||||
end
|
||||
end,
|
||||
{description = "Switch to next tag", group = "client"}
|
||||
),
|
||||
|
||||
-- =========================================
|
||||
|
|
Loading…
Reference in New Issue