How cycle between last two clients ?

Added by david unric almost 5 years ago

I'd appreciate some working snippet how to switch between current and last focused client (window).
Tried Subtlext::Client.recent array but its contents is unreliable, like duplicity of the same client at 0 and 1 indexes.

Thanks in an advance.


Replies (3)

RE: How cycle between last two clients ? - Added by Christoph Kappel almost 5 years ago

If you have issues like that why not just sorting the recent array? Currently there's no check for duplicated entries, when you delete a window. subtle just removes the window and shifts the other down/up.

1 grab "A-b" do
2   Subtlext::Client.recent.uniq[-1].focus
3 end

RE: How cycle between last two clients ? - Added by david unric almost 5 years ago

Thanks Christoph, although I find this as a hack rather than a solution.
Now I have to fix yet switching between last two clients on different views. When I switch from one view with multiple clients to another view and then back, focus gets other client than the original one I did switched from.

I did peek in Subtle sources and suppose all the problems with focus storage may be solved by temporarily disabling focus recieved from mouse cursor when clients/views/screens are switched with keyboard. Just a suggestion. As I don't programm for XOrg, I don't know how to disable mouse focus.

Take care.

David

RE: How cycle between last two clients ? - Added by Christoph Kappel almost 5 years ago

I am aware of the problem, but apparently it isn't easy to fix - tried it several times without success. Would be easier with a different code design, but it also eases many things.

Btw: When you switch just the view instead of messing with the focus history, subtle does that on its own. Views keep the last focussed window, maybe I should use this information to fill the history. Going to check that.

(1-3/3)