diff options
author | Peter Palfrader <peter@palfrader.org> | 2017-07-17 09:56:13 +0200 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2017-07-17 09:56:13 +0200 |
commit | abdea726e580d06d4fac21b341426607c32a15ad (patch) | |
tree | 169d33bb41a50281dd41388e1bf3f5534d1d3814 | |
parent | 8c67217d1dd4514a654ee79021d9d897efbd3b85 (diff) |
Take clients along with modkey+Ctrl+arrows
-rw-r--r-- | config/awesome/rc.lua | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index 90f3bbf..05d3251 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -350,7 +350,7 @@ globalkeys = awful.util.table.join( ) -- more weasel - local function viewidx_no_wrap(num_cols, delta_rows, delta_cols) + local function viewidx_no_wrap(num_cols, delta_rows, delta_cols, cl) local screen = awful.screen.focused() local cur = awful.tag.getidx() local cc = (cur-1) % num_cols @@ -358,16 +358,28 @@ globalkeys = awful.util.table.join( if cc + delta_cols >= 0 and cc + delta_cols < num_cols and cur + jump > 0 and cur + jump <= #screen.tags then + if cl then + do_not_reset_focus = true + end awful.tag.viewidx(jump) + if cl then + local newtag = awful.tag.selected(screen) + cl:move_to_tag(newtag) + end end end globalkeys = awful.util.table.join(globalkeys, - awful.key({ modkey2, }, "Left" , function () viewidx_no_wrap (5, 0, -1) end ), - awful.key({ modkey2, }, "Right", function () viewidx_no_wrap (5, 0, 1) end ), - awful.key({ modkey2, }, "Up" , function () viewidx_no_wrap (5, -1, 0) end ), - awful.key({ modkey2, }, "Down" , function () viewidx_no_wrap (5, 1, 0) end ) + awful.key({ modkey2, }, "Left" , function () viewidx_no_wrap (5, 0, -1, false) end ), + awful.key({ modkey2, }, "Right", function () viewidx_no_wrap (5, 0, 1, false) end ), + awful.key({ modkey2, }, "Up" , function () viewidx_no_wrap (5, -1, 0, false) end ), + awful.key({ modkey2, }, "Down" , function () viewidx_no_wrap (5, 1, 0, false) end ) + ) + globalkeys = awful.util.table.join(globalkeys, + awful.key({ modkey2, "Ctrl" }, "Left" , function () viewidx_no_wrap (5, 0, -1, client.focus) end ), + awful.key({ modkey2, "Ctrl" }, "Right", function () viewidx_no_wrap (5, 0, 1, client.focus) end ), + awful.key({ modkey2, "Ctrl" }, "Up" , function () viewidx_no_wrap (5, -1, 0, client.focus) end ), + awful.key({ modkey2, "Ctrl" }, "Down" , function () viewidx_no_wrap (5, 1, 0, client.focus) end ) ) - local tag_keys = { "1", "2", "3", "4", "5", @@ -639,21 +651,25 @@ client.connect_signal("focus", function(c) c.border_color = beautiful.border_foc client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) -- from/inspired by https://stackoverflow.com/a/30684548 +do_not_reset_focus = false tag.connect_signal( "property::selected", function (t) local selected = tostring(t.selected) == "false" if selected then - local focus_timer = timer({ timeout = 0.05 }) - focus_timer:connect_signal("timeout", function() - local c = awful.mouse.client_under_pointer() - if not (c == nil) then - client.focus = c - -- c:raise() - end - focus_timer:stop() - end) - focus_timer:start() + if not do_not_reset_focus then + local focus_timer = timer({ timeout = 0.05 }) + focus_timer:connect_signal("timeout", function() + local c = awful.mouse.client_under_pointer() + if not (c == nil) then + client.focus = c + -- c:raise() + end + focus_timer:stop() + end) + focus_timer:start() + end + do_not_reset_focus = false end end ) |