From e40ad11ec0ba6c4b5bac08da0bdfd5beb90b2122 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Fri, 15 Oct 2021 19:50:22 -0700 Subject: [PATCH] shims: Implement client:swap(). --- tests/examples/shims/client.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/examples/shims/client.lua b/tests/examples/shims/client.lua index f816016b..208fe7c2 100644 --- a/tests/examples/shims/client.lua +++ b/tests/examples/shims/client.lua @@ -192,6 +192,24 @@ function client.gen_fake(args) assert(not ret.valid) end + function ret:swap(other) + local idx1, idx2 = nil, nil + for k, c in ipairs(clients) do + if c == ret then + idx1 = k + elseif c == other then + idx2 = k + end + end + + if not (idx1 and idx2) then return end + + clients[idx1], clients[idx2] = other, ret + ret:emit_signal("swapped", other, true) + other:emit_signal("swapped", ret, false) + client.emit_signal("list") + end + titlebar_meta(ret) function ret:tags(new) --FIXME