From c613624f3979ab50c366957bc992f805b6e254cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Pankowski?= Date: Sat, 20 Sep 2025 09:37:27 +0200 Subject: [PATCH] awesome: better toggle maximize, add keys to focus nth window on active tag --- awesome/.config/awesome/rc.lua | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/awesome/.config/awesome/rc.lua b/awesome/.config/awesome/rc.lua index e4e5a1f..25da9f4 100644 --- a/awesome/.config/awesome/rc.lua +++ b/awesome/.config/awesome/rc.lua @@ -236,6 +236,15 @@ local function layout_menu() awful.menu(layouts):show() 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 local globalkeys = gears.table.join( awful.key({ modkey, }, "s", hotkeys_popup.show_help, @@ -368,8 +377,11 @@ local clientkeys = gears.table.join( { description = "minimize", group = "client" }), awful.key({ modkey, }, "m", function(c) - c.maximized = not c.maximized - c:raise() + if awful.layout.getname() == "max" then + awful.layout.set(awful.layout.suit.tile) + else + awful.layout.set(awful.layout.suit.max) + end end, { description = "(un)maximize", group = "client" }), awful.key({ modkey, }, "v", @@ -432,7 +444,11 @@ for i = 1, 9 do 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