bspwm icon indicating copy to clipboard operation
bspwm copied to clipboard

[Feature Request] Additional Preselect Option

Open pyuk opened this issue 7 years ago • 7 comments

I noticed one particular layout that, as far as I can see, can't be created with bspwm using preselection:

+-----------------------+
|               |       |
|               |       |
|-------+-------|       |
|       |       |       |
|       |       |       |
|       |-------+-------|
|       |               |
|       |               |
+-----------------------+

I know it doesn't really matter functionally, but feel like I could make some really cool looking layouts using that as a base. So I was thinking about features that would allow that kind of layout to be made in a way that feels right in bspwm using preselection, and this is what I came up with. Normally bspwm can only spawn new windows within a current window. I think it should be possible to open new windows across multiple windows. This is how I was picturing it:

+-----------------------+ +-----------------------+ +-----------------------+ +-----------------------+
|           |           | |           |           | |           |           | |           |           |
|           |           | |           |           | |           |           | |           |           |
|           |           | |           |           | |           |           | |           |           |
|     ^     |           | |+++++^+++++|           | |+++++^+++++|+++++++++++| |-----------------------|
|           |           | |+++++++++++|           | |+++++++++++|+++++++++++| |                       |
|           |           | |+++++++++++|           | |+++++++++++|+++++++++++| |           ^           |
|           |           | |+++++++++++|           | |+++++++++++|+++++++++++| |                       |
+-----------------------+ +-----------------------+ +-----------------------+ +-----------------------+
                               super + ctrl + j       super + ctrl + period        super + enter

The pluses represent the preselection and the shortcut super + ctrl + {period,comma} would extend the preselection one window left/right or up/down. Here's another example:

+-----------------------+ +-----------------------+ +-----------------------+ +-----------------------+ +-----------------------+
|     |     |     |     | |     |     |     |     | |     |     |     |     | |     |     |     |     | |     |     |     |     |
|     |     |     |     | |     |     |     |     | |     |     |     |     | |     |     |     |     | |     |     |     |     |
|     |     |     |     | |     |     |     |     | |     |     |     |     | |     |     |     |     | |     |     |     |     |
|     |++^++|-----|     | |+++++|++^++|-----|     | |     |++^++|-----|     | |     |  ^  |-----|     | |     |  ^  |-----|     |
|     |+++++|     |     | |+++++|+++++|     |     | |     |+++++|     |     | |     |     |     |     | |     |     |     |     |
|     |+++++|     |-----| |+++++|+++++|     |-----| |     |+++++|     |-----| |     |+++++|+++++|-----| |     |     |     |-----|
|     |+++++|     |     | |+++++|+++++|     |     | |     |+++++|     |     | |     |+++++|+++++|     | |     |+++++|+++++|+++++|
+-----------------------+ +-----------------------+ +-----------------------+ +-----------------------+ +-----------------------+
                            super + ctrl + comma      super + ctrl + period     super + ctrl + period     super + ctrl + period

To note here is if the window that's being extended into is smaller than the original window, the preselection should shrink to half the size of the smaller window (or whatever the set ratio is). Going up and down can work the same way.

+-----------------------+ +-----------------------+ +-----------------------+ +-----------------------+
|                       | |                       | |             ++++++++++| |                       |
|                       | |                       | |             ++++++++++| |                       |
|-----------------------| |-----------------------| |-----------------------| |-----------------------|
|   |                   | |   |         ++++++++++| |   |         ++++++++++| |   |         ++++++++++|
|   |                   | |   |         ++++++++++| |   |         ++++++++++| |   |         ++++++++++|
|-----------------------| |-----------------------| |-----------------------| |-----------------------|
|           ^+++++++++++| |           ^ ++++++++++| |           ^ ++++++++++| |           ^ ++++++++++|
|           ++++++++++++| |             ++++++++++| |             ++++++++++| |             ++++++++++|
+-----------------------+ +-----------------------+ +-----------------------+ +-----------------------+
                            super + ctrl + period     super + ctrl + period     super + ctrl + comma   

I really enjoy trying to make good looking layouts, and I feel this would open up a range of new possibilities in bspwm, so please consider implementing it.

pyuk avatar May 02 '19 18:05 pyuk

Normally bspwm can only spawn new windows within a current window. I think it should be possible to open new windows across multiple windows.

you can preselect on a parent node and spawn onto that preselection. isn that more or less what you are asking for?

ortango avatar May 08 '19 19:05 ortango

The feature I'm asking for would allow for preselecting across any adjacent window, and parent node preselections only allow selecting the whole parent node. The layout I mentioned above can only be made if it's possible to preselect across any window. Here's an example of a preselection that can't be made with parent node preselection as far as I can see:

+-----------------------+
|           |           |
|           |           |
|           |           |
|           |-----------|
|           |     |     |
|+++++++++++|+++++|     |
|+++++++++++|+++++|     |
+-----------------------+

It's definitely an aesthetic feature, and probably won't offer a whole lot of functionality that isn't already there, but think of the cool looking layouts that could be made.

pyuk avatar May 08 '19 22:05 pyuk

yea, you can not make the first example from your original post - you can almost do it, but not the final cut.

how would bspwm's btree look if you could make that cut (one child but not the other, and an 'uncle' node)

ortango avatar May 09 '19 00:05 ortango

From the readme page:

bspwm [...] represents windows as the leaves of a full binary tree.

I don't think it's possible to represent the first layout in the tree.

mdutra avatar May 09 '19 00:05 mdutra

Another possibility would be to change how resizing windows works. Right now when resizing windows, this is how bspwm behaves:

+-----------------------+ +-----------------------+ +-----------------------+
|         |             | |           |           | |           |           |
|    ^    |             | |     ^     |           | |     ^     |           |
|         |             | |           |           | |           |           |
|-----------------------| |-----------------------| |           |           |
|           |           | |           |           | |-----------------------|
|           |           | |           |           | |           |           |
|           |           | |           |           | |           |           |
+-----------------------+ +-----------------------+ +-----------------------+
                               super + alt + l           super + alt + j

If it behaved more like this, we could make the layout:

+-----------------------+ +-----------------------+ +-----------------------+ +-----------------------+ +-----------------------+
|         |             | |           |           | |           |           | |           |           |	|             |         |
|    ^    |             | |     ^     |           | |     ^     |           | |     ^     |           |	|      ^      |         |
|         |             | |           |           | |           |           | |           |           |	|             |         |
|-----------------------| |-----------+-----------| |           |-----------| |-----------+-----------|	|-----------------------|
|           |           | |           |           | |-----------|           | |           |           |	|           |           |
|           |           | |           |           | |           |           | |           |           |	|           |           |
|           |           | |           |           | |           |           | |           |           |	|           |           |
+-----------------------+ +-----------------------+ +-----------------------+ +-----------------------+	+-----------------------+
			       super + alt + l           super + alt + j       super + alt + shift + k	     super + alt + l

So anytime the corners of four windows meet, they would snap together and resizing windows horizontally or vertically into the window next to or below it would be possible. In terms of the binary tree, we could make the node each window belongs to in the case four corners meet dynamic. So if it's resized down or up there would be two vertical nodes, and if left or right two horizontal nodes. That makes sense, right?

pyuk avatar May 09 '19 18:05 pyuk

So anytime the corners of four windows meet, they would snap together and resizing windows horizontally or vertically

This could work but ends up with the same tree. It would only swap the nodes:

    a                  a
   / \                / \
  c   b     --->     c   b
 / \ / \            / \ / \
1  2 3  4          1  3 2  4

So even with this resize "trick", I don't think it's possible to get to the final layout.

So if it's resized down or up there would be two vertical nodes, and if left or right two horizontal nodes.

There's no horizontal or vertical node. To move the way you want, you need the both nodes (the nodes that are being affected by the resize) to be siblings.

mdutra avatar May 10 '19 05:05 mdutra

The first layout isn't representable.

baskerville avatar May 10 '19 08:05 baskerville