baskerville / bspwm

A tiling window manager based on binary space partitioning
BSD 2-Clause "Simplified" License
7.8k stars 415 forks source link

Allow for boundary distance to be negative for overlapping windows #1501

Closed sgp729 closed 2 months ago

sgp729 commented 4 months ago

In a layouts like so:

     +----------+
     |          |  +----------+
     |    W3+------|          |
     |      |      |    W1    |
     +------|    W2|          |
            |      +----------+
            +----------+
                |  |   |
           w3_max  w1  w2_max

Switching from focused W1 to the west will switch to the W3 despite W2 being visually closer. It happens because the absolute distance w3_max - w1 is less than w2_max - w1.

Allowing for distance to be negative solves the problem: negative values are preferred by the search algorithm and the closer the overlapping windows are, the lesser the negative distance becomes, allowing to switch to the closest overlapping window if there are many.