Merge pull request #3225 from mphe/focus_bydirection_fix

Use focus.filter in awful.client.focus.(global_)bydirection
This commit is contained in:
mergify[bot] 2023-05-18 13:59:42 +00:00 committed by GitHub
commit 485661b706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 2 deletions

View File

@ -174,7 +174,9 @@ function focus.bydirection(dir, c, stacked)
local cltbl = client.visible(sel.screen, stacked)
local geomtbl = {}
for i,cl in ipairs(cltbl) do
geomtbl[i] = cl:geometry()
if focus.filter(cl) then
geomtbl[i] = cl:geometry()
end
end
local target = grect.get_in_direction(dir, geomtbl, sel:geometry())
@ -211,7 +213,9 @@ function focus.global_bydirection(dir, c, stacked)
local cltbl = client.visible(screen.focused(), stacked)
local geomtbl = {}
for i,cl in ipairs(cltbl) do
geomtbl[i] = cl:geometry()
if focus.filter(cl) then
geomtbl[i] = cl:geometry()
end
end
local target = grect.get_in_direction(dir, geomtbl, scr.geometry)

View File

@ -0,0 +1,40 @@
-- Test for https://github.com/awesomeWM/awesome/pull/3225
local runner = require("_runner")
local awful = require("awful")
local beautiful = require("beautiful")
-- Ensure clients are placed next to each other
beautiful.column_count = 3
awful.screen.focused().selected_tag.layout = awful.layout.suit.tile
local steps = {
function(count)
if count == 1 then
awful.spawn("xterm")
awful.spawn("xterm")
awful.spawn("xterm")
else
local cleft = client.get()[1]
local cright = client.get()[3]
client.get()[2].focusable = false
-- Test with focus.bydirection
client.focus = cleft
awful.client.focus.bydirection("right")
assert(client.focus == cright)
-- Test with focus.global_bydirection
client.focus = cleft
awful.client.focus.global_bydirection("right")
assert(client.focus == cright)
return true
end
end,
}
runner.run_steps(steps)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80