awesome: better toggle maximize, add keys to focus nth window on active tag

This commit is contained in:
2025-09-20 09:37:27 +02:00
parent ec87546913
commit ff8b03f04d

View File

@@ -236,6 +236,15 @@ local function layout_menu()
awful.menu(layouts):show() awful.menu(layouts):show()
end end
local function focus_nth_window (n)
local cc = {}
for _, c in ipairs(client.get()) do
if awful.widget.tasklist.filter.currenttags(c, mouse.screen) then cc[#cc + 1] = c end
end
local new_focused = cc[n]
if new_focused then client.focus = new_focused; new_focused:raise() end
end
-- {{{ Key bindings -- {{{ Key bindings
local globalkeys = gears.table.join( local globalkeys = gears.table.join(
awful.key({ modkey, }, "s", hotkeys_popup.show_help, awful.key({ modkey, }, "s", hotkeys_popup.show_help,
@@ -368,8 +377,11 @@ local clientkeys = gears.table.join(
{ description = "minimize", group = "client" }), { description = "minimize", group = "client" }),
awful.key({ modkey, }, "m", awful.key({ modkey, }, "m",
function(c) function(c)
c.maximized = not c.maximized if awful.layout.getname() == "max" then
c:raise() awful.layout.set(awful.layout.suit.tile)
else
awful.layout.set(awful.layout.suit.max)
end
end, end,
{ description = "(un)maximize", group = "client" }), { description = "(un)maximize", group = "client" }),
awful.key({ modkey, }, "v", awful.key({ modkey, }, "v",
@@ -432,7 +444,11 @@ for i = 1, 9 do
end end
end end
end, end,
{ description = "toggle focused client on tag #" .. i, group = "tag" }) { description = "toggle focused client on tag #" .. i, group = "tag" }),
--- Focus nth window
awful.key({ "Control" }, "#" .. i + 9,
function() focus_nth_window(i) end,
{ description = "focus window index #" .. i, group = "client" })
) )
end end