patches icon indicating copy to clipboard operation
patches copied to clipboard

Improving the focusdir patch

Open jzbor opened this issue 3 years ago • 4 comments

I was bothered by it switching always to the top of the stack. So now it always switches to the last focused window if multiple windows have the same horizontal (vertical) distance and are not in a monocle/deck/similar layout.

jzbor avatar Mar 02 '21 12:03 jzbor

Hm I have some problems with floating windows, but I am not quiet sure if thats up to my changes, as they should not affect those windows anyway...

jzbor avatar Mar 02 '21 12:03 jzbor

I'm not sure how these changes make any difference. The dist variable is hardcoded as 3000000 so this will only have an effect if the client_dist happens to also be calculated as 3000000. What am I missing?

If the currently selected client is floating then focusdir will try to select the next floating client in a given direction. If the currently selected client is tiled then focusdir will try to select the next tiled client in a given direction.

It is complicated to do this properly when windows are overlapping (floating windows or fake floating master layouts).

I'd say that there is definitely room for improvement with regards to this patch so thank you for looking into it.

bakkeby avatar Mar 02 '21 13:03 bakkeby

So for the initial dist value I just chose a ridiculously high number so that it does not coincidentally trigger (which may be possible if you would take for example '0'. I am not entirely sure if this is necessary. Of cause you could add a check if the variable is initialized and leave it uninitialized, but this seemed like the easiest way to do it. Admittedly not the most beautiful way.

I see your problem with floating windows. I think I'll try considering only the upper right corner. I think for me personally that would work fine. Of course for non-programmers this might not be intuitive.

jzbor avatar Mar 02 '21 19:03 jzbor

I think I'll try considering only the upper right corner.

Ok nvm I think I have no idea on how to do that...

jzbor avatar Mar 02 '21 19:03 jzbor