Support moving a client to an empty screen
This commit is contained in:
parent
98e5564dac
commit
52416fb650
18
focus.lua
18
focus.lua
|
@ -105,12 +105,15 @@ local function bydirection(dir, c, swap,max)
|
||||||
geomtbl[i] = cl:geometry()
|
geomtbl[i] = cl:geometry()
|
||||||
end
|
end
|
||||||
local target = util.get_rectangle_in_direction(dir, geomtbl, c:geometry())
|
local target = util.get_rectangle_in_direction(dir, geomtbl, c:geometry())
|
||||||
|
if swap ~= true then
|
||||||
-- If we found a client to focus, then do it.
|
-- If we found a client to focus, then do it.
|
||||||
if target then
|
if target then
|
||||||
if swap ~= true then
|
|
||||||
capi.client.focus = cltbl[((not cltbl[target] and #cltbl == 1) and 1 or target)]
|
capi.client.focus = cltbl[((not cltbl[target] and #cltbl == 1) and 1 or target)]
|
||||||
capi.client.focus:raise()
|
capi.client.focus:raise()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
if target then
|
||||||
|
-- We found a client to swap
|
||||||
local other = cltbl[((not cltbl[target] and #cltbl == 1) and 1 or target)]
|
local other = cltbl[((not cltbl[target] and #cltbl == 1) and 1 or target)]
|
||||||
if other.screen == c.screen or col_utils.settings.swap_across_screen then
|
if other.screen == c.screen or col_utils.settings.swap_across_screen then
|
||||||
--BUG swap doesn't work if the screen is not the same
|
--BUG swap doesn't work if the screen is not the same
|
||||||
|
@ -120,6 +123,19 @@ local function bydirection(dir, c, swap,max)
|
||||||
c.screen = other.screen
|
c.screen = other.screen
|
||||||
c:tags({t})
|
c:tags({t})
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
-- No client to swap, try to find a screen.
|
||||||
|
local screen_geom = {}
|
||||||
|
for i = 1, capi.screen.count() do
|
||||||
|
screen_geom[i] = capi.screen[i].workarea
|
||||||
|
end
|
||||||
|
target = util.get_rectangle_in_direction(dir, screen_geom, c:geometry())
|
||||||
|
if target and target ~= c.screen then
|
||||||
|
local t = tag.selected(target)
|
||||||
|
c.screen = target
|
||||||
|
c:tags({t})
|
||||||
|
c:raise()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
display_wiboxes(cltbl,geomtbl,float,swap,c)
|
display_wiboxes(cltbl,geomtbl,float,swap,c)
|
||||||
|
|
Loading…
Reference in New Issue