On 2011-11-09, Daniel <[email protected]> wrote:
>>> Given all the currently visible clients, as per:
>>> awful.client.visible(client.focus.screen), I would like to arbitrarily pick
>>> a client by index, put this client first in the list, and shift the other
>>> clients in the list accordingly (as needed). Any tips?
>>
>> Try this:
>>
>> idx = 3 -- whereever your client is
>> c = awful.client.visible(client.focus.screen)
>> c[idx]:swap(c[1])
>
> This will only swap client idx with the first one. Not shift the other clients
> accordingly. But now I see that what I probably need to do is repeatedly
>
> c[idx]:swap(c[idx-1])
>
> while decreasing idx and idx==2. I will give that a try later.
Ok, almost there. For an overview: what I have is certain keys that
run-or-raise clients, and I would like a client that was raised to be moved
first in the list of clients (and thus leftmost in the tasklist). I also have
Alt-Tab to swap between client 1 and 2 in that list, so Alt-Tab will
essentially end up swapping between the two most recently activated
(run-or-raised) clients (on that tag, anyway).
The run-or-raise function raises the correct client (idx), and then swaps it
towards the first position. If I do it once, like this:
cls = awful.client.visible(client.focus.screen)
if idx>1 then
cls[idx-1]:swap(cls[idx])
end
then consequtive presses of the key that runs-or-raises this particular client
does indeed move it one step left in the tasklist for each press. But when I
try to swap it all the way in one go, like this:
while idx>1 do
cls[idx-1]:swap(cls[idx])
idx = idx-1
end
It is moved not only just one step to the left, but other client(s?) are as
well moved around (I couldn't determine exactly how just now). Do I somehow
mess up the client list by swapping several times within the same function
(which is bound to a key)?
--
To unsubscribe, send mail to [email protected].