From 6d98d3acc65e9b0cc363de9ad26e6d20fb40bd50 Mon Sep 17 00:00:00 2001 From: Blista Kanjo Date: Tue, 22 Aug 2023 14:49:19 -0400 Subject: refactor: moved some binds into `client.connect_signal()` --- .config/awesome/rc.lua | 57 ++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index 53144e7..cb56e32 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -530,35 +530,6 @@ awful.keyboard.append_global_keybindings({ end, { description = "show the menubar", group = "launcher" }), - -- move client to prev/next tag and switch to it - awful.key({ modkey, "Shift" }, "Left", - function() - -- get current tag - local t = client.focus and client.focus.first_tag or nil - if t == nil then - return - end - -- get previous tag (modulo 9 excluding 0 to wrap from 1 to 9) - local tag = client.focus.screen.tags[(t.name - 2) % 9 + 1] - client.focus:move_to_tag(tag) - awful.tag.viewprev() - end, - { description = "move client to previous tag and switch to it", group = "tag" }), - - awful.key({ modkey, "Shift" }, "Right", - function() - -- get current tag - local t = client.focus and client.focus.first_tag or nil - if t == nil then - return - end - -- get next tag (modulo 9 excluding 0 to wrap from 9 to 1) - local tag = client.focus.screen.tags[(t.name % 9) + 1] - client.focus:move_to_tag(tag) - awful.tag.viewnext() - end, - { description = "move client to next tag and switch to it", group = "tag" }), - -- tags manipulation via keyboard number row awful.keyboard.append_global_keybindings({ awful.key { @@ -679,7 +650,33 @@ client.connect_signal("request::default_keybindings", function() c.maximized_horizontal = not c.maximized_horizontal c:raise() end, - { description = "(un)maximize horizontally", group = "client" }) + { description = "(un)maximize horizontally", group = "client" }), + + -- move client to prev/next tag and switch to it + awful.key({ modkey, "Shift" }, "Left", + function() + local t = client.focus and client.focus.first_tag or nil + if t == nil then + return + end + + local tag = client.focus.screen.tags[(t.name - 2) % 9 + 1] + client.focus:move_to_tag(tag) + awful.tag.viewprev() + end, + { description = "move client to previous tag and switch to it", group = "tag" }), + awful.key({ modkey, "Shift" }, "Right", + function() + local t = client.focus and client.focus.first_tag or nil + if t == nil then + return + end + + local tag = client.focus.screen.tags[(t.name % 9) + 1] + client.focus:move_to_tag(tag) + awful.tag.viewnext() + end, + { description = "move client to next tag and switch to it", group = "tag" }), }) end) -- cgit v1.2.3