hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
19.92k stars 849 forks source link

Focus master / swap with master behaviour #1054

Open julianschuler opened 1 year ago

julianschuler commented 1 year ago

When using the master layout and either "focusmaster" or "swapwithmaster", the focus / layout remains unchanged if the focused window is already the master.

Spectrwm e.g. exhibits the following behavior: If the focused window is the master, focus / swap with the last window from the stack instead.

I would like to implement this behavior in Hyprland as well. Do you prefer replacing the current behavior or instead adding new options (e.g. "focusmastertoggle" / "swapwithmastertoggle")?

vaxerski commented 1 year ago

done in f8b91383835bd2cfc03ad5e2337f3a25332f7cb4

julianschuler commented 1 year ago

You are awesome!

julianschuler commented 1 year ago

First of all, thank you again for your quick implementation!

Upon testing, I noticed that my description of the desired focus and swapping behavior was not so great. With the last window from the stack I meant the most recently used one.

Consider the following example layout with * denoting the currently focused window:

+-----------+-----------+
|           |     B     |
|           +-----------+
|     A     |     C*    |
|           +-----------+
|           |     D     |
+-----------+-----------+

After the first "focusmaster", we retrieve the following:

+-----------+-----------+
|           |     B     |
|           +-----------+
|     A*    |     C     |
|           +-----------+
|           |     D     |
+-----------+-----------+

After the second "focusmaster", the current implementation yields the following:

+-----------+-----------+
|           |     B*    |
|           +-----------+
|     A     |     C     |
|           +-----------+
|           |     D     |
+-----------+-----------+

This is how spectrwm handles the same case and the way I originally intended:

+-----------+-----------+
|           |     B     |
|           +-----------+
|     A     |     C*    |
|           +-----------+
|           |     D     |
+-----------+-----------+

The behavior of the swapping case is similar. Should I open a new issue for this?

vaxerski commented 1 year ago

ugh w8

vaxerski commented 1 year ago

keep this