Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All the floating windows are above the non-floating windows #2170

Closed
seonjunn opened this issue Mar 18, 2024 · 13 comments
Closed

All the floating windows are above the non-floating windows #2170

seonjunn opened this issue Mar 18, 2024 · 13 comments
Labels
help wanted Community help appreciated question Request for information or help, not an issue

Comments

@seonjunn
Copy link

After updating yabai to the head after my mac update, all the floating windows are placed above the non-floating (tiled) windows even when I switch the focus to the tiled windows.

$ yabai --version
yabai-v7.0.2
$ sw_vers
ProductName:		macOS
ProductVersion:		14.4
BuildVersion:		23E214

I would provide any other info (configs) if required.

@shrugalic
Copy link

shrugalic commented Mar 18, 2024

Isn't the point of floating windows that they float in front of everything else?

Edit: Nevermind. To answer my own question. No, it's not, that would be sticky, not float. My error was because my System Settings window is also sticky:

yabai -m rule --add app="^System Settings$" sticky=on

That said, I also have layering issues with v7.0.2, but of a different kind (Similar to #1929, created #2172 today)

@jpsummer
Copy link

I'm having the exact same issue after updating MacOS to Sonoma, every floating window is sticky on top of any tiling window.

@shrugalic
Copy link

shrugalic commented Mar 18, 2024

FYI (regarding the other layering issue #2172 I mentioned): There was a breaking change in v 0.7.x, as documented in #2128

Solution: use sub-layer instead of layer.

This solves my issue:

yabai -m rule --add app=".*" sub-layer=normal

With this setting, I also don't have the original issue described by the OP.

@benkoppe
Copy link

benkoppe commented Mar 18, 2024

yabai -m rule --add app=".*" sub-layer=normal changes nothing for me. I'm still having the same issue as described on MacOS Ventura.

@shrugalic
Copy link

For debugging it might be helpful to check out what properties the windows in question have, in particular that they're not sticky by accident or suchlike:

yabai -m query --windows

@seonjunn
Copy link
Author

sub-layer=normal does not help me either.

@koekeishiya
Copy link
Owner

koekeishiya commented Mar 20, 2024

Output of yabai -m query --windows ?

Also note changes to window rules in v7.0.0:

Add a new rule. Rules apply to windows that spawn after said rule has been added.

For yabai -m rule --add app=".*" sub-layer=normal to apply to windows that are already opened before yabai is launched or this rule is added, you need to also run yabai -m rule --apply

--add [--one-shot] []

Add a new rule. Rules apply to windows that spawn after said rule has been added.
If --one-shot is present it will apply once and automatically remove itself.

--apply [<RULE_SEL> | ]

Apply a rule to currently known windows.
If no argument is given, all existing rules will apply.
If an index or label is given, that particular rule will apply.
Arguments can also be provided directly, just like in the --add command.
Existing --one-shot rules that have yet to apply will be ignored by this command.

@koekeishiya koekeishiya added help wanted Community help appreciated question Request for information or help, not an issue labels Mar 20, 2024
@seonjunn
Copy link
Author

Running yabai -m rule --apply after yabai -m rule --add app=".*" sub-layer=normal worked.
Which config should I modify to make this as default?
Following is the output of yabai -m query --windows.
As you can see Finder is the app that is floating, and does not go behind even when I move focus to the non-floating app (kitty or Firefox in this case).

[{
	"id":13124,
	"pid":619,
	"app":"Finder",
	"title":"Downloads",
	"frame":{
		"x":162.0000,
		"y":92.0000,
		"w":920.0000,
		"h":436.0000
	},
	"role":"AXWindow",
	"subrole":"AXStandardWindow",
	"root-window":true,
	"display":1,
	"space":2,
	"level":0,
	"sub-level":0,
	"layer":"normal",
	"sub-layer":"normal",
	"opacity":0.9000,
	"split-type":"none",
	"split-child":"none",
	"stack-index":0,
	"can-move":true,
	"can-resize":true,
	"has-focus":false,
	"has-shadow":true,
	"has-parent-zoom":false,
	"has-fullscreen-zoom":false,
	"has-ax-reference":true,
	"is-native-fullscreen":false,
	"is-visible":true,
	"is-minimized":false,
	"is-hidden":false,
	"is-floating":true,
	"is-sticky":false,
	"is-grabbed":false
},{
	"id":13128,
	"pid":2094,
	"app":"kitty",
	"title":"yabai -m query --win ~",
	"frame":{
		"x":5.0000,
		"y":512.0000,
		"w":748.0000,
		"h":465.0000
	},
	"role":"AXWindow",
	"subrole":"AXStandardWindow",
	"root-window":true,
	"display":1,
	"space":2,
	"level":0,
	"sub-level":-20,
	"layer":"normal",
	"sub-layer":"below",
	"opacity":1.0000,
	"split-type":"horizontal",
	"split-child":"second_child",
	"stack-index":0,
	"can-move":true,
	"can-resize":true,
	"has-focus":true,
	"has-shadow":true,
	"has-parent-zoom":false,
	"has-fullscreen-zoom":false,
	"has-ax-reference":true,
	"is-native-fullscreen":false,
	"is-visible":true,
	"is-minimized":false,
	"is-hidden":false,
	"is-floating":false,
	"is-sticky":false,
	"is-grabbed":false
},{
	"id":13034,
	"pid":1393,
	"app":"Firefox",
	"title":"All the floating windows are above the non-floating windows · Issue #2170 · koekeishiya/yabai",
	"frame":{
		"x":758.0000,
		"y":42.0000,
		"w":748.0000,
		"h":935.0000
	},
	"role":"AXWindow",
	"subrole":"AXStandardWindow",
	"root-window":true,
	"display":1,
	"space":2,
	"level":0,
	"sub-level":-20,
	"layer":"normal",
	"sub-layer":"below",
	"opacity":0.9000,
	"split-type":"vertical",
	"split-child":"second_child",
	"stack-index":0,
	"can-move":true,
	"can-resize":true,
	"has-focus":false,
	"has-shadow":true,
	"has-parent-zoom":false,
	"has-fullscreen-zoom":false,
	"has-ax-reference":true,
	"is-native-fullscreen":false,
	"is-visible":true,
	"is-minimized":false,
	"is-hidden":false,
	"is-floating":false,
	"is-sticky":false,
	"is-grabbed":false
},{
	"id":13046,
	"pid":2094,
	"app":"kitty",
	"title":"vim .config/yabai/ya ~",
	"frame":{
		"x":5.0000,
		"y":42.0000,
		"w":748.0000,
		"h":465.0000
	},
	"role":"AXWindow",
	"subrole":"AXStandardWindow",
	"root-window":true,
	"display":1,
	"space":2,
	"level":0,
	"sub-level":-20,
	"layer":"normal",
	"sub-layer":"below",
	"opacity":0.9000,
	"split-type":"horizontal",
	"split-child":"first_child",
	"stack-index":0,
	"can-move":true,
	"can-resize":true,
	"has-focus":false,
	"has-shadow":true,
	"has-parent-zoom":false,
	"has-fullscreen-zoom":false,
	"has-ax-reference":true,
	"is-native-fullscreen":false,
	"is-visible":true,
	"is-minimized":false,
	"is-hidden":false,
	"is-floating":false,
	"is-sticky":false,
	"is-grabbed":false
},{
	"id":12996,
	"pid":1393,
	"app":"firefox",
	"title":"",
	"frame":{
		"x":5.0000,
		"y":42.0000,
		"w":1502.0000,
		"h":935.0000
	},
	"role":"",
	"subrole":"",
	"root-window":true,
	"display":1,
	"space":1,
	"level":0,
	"sub-level":0,
	"layer":"normal",
	"sub-layer":"normal",
	"opacity":1.0000,
	"split-type":"none",
	"split-child":"none",
	"stack-index":0,
	"can-move":false,
	"can-resize":false,
	"has-focus":false,
	"has-shadow":true,
	"has-parent-zoom":false,
	"has-fullscreen-zoom":false,
	"has-ax-reference":false,
	"is-native-fullscreen":false,
	"is-visible":false,
	"is-minimized":false,
	"is-hidden":false,
	"is-floating":false,
	"is-sticky":false,
	"is-grabbed":false
}]

@shrugalic
Copy link

shrugalic commented Mar 21, 2024

Which config should I modify to make this as default?

If I understand the documentation correctly (which koekeishiya graciously left above), having the rule yabai -m rule --add app=".*" sub-layer=normal in your config should help prevent the issue for all windows you'll spawn in the future.

And running yabai -m rule --apply applied this rule to the windows you already had open. This should be a one time thing, if you have the previously mentioned rule in your config.

Edit: Though come to think of it, I'm not entirely sure what happens to windows when you restart yabai with them open. Hopefully they'll just keep their properties, assuming their properties were "good" (as in, what you want them to be). If not, running yabai -m rule --apply should help – and I guess that's what'll happen.

Similarly, I'm not 100% sure what happens when you restart the computer, because I suppose it depends on when yabai starts in relation to other apps with open windows (as in: before or after). We'll see I guess, for now it's great to know about this behavior and know about the yabai -m rule --apply command as a tool in our belt. :)

Edit 2: Upon re-reading his comments, in particular this one:

For yabai -m rule --add app=".*" sub-layer=normal to apply to windows that are already opened before yabai is launched or this rule is added, you need to also run yabai -m rule --apply

This would mean that we'll need to apply the rules on every relaunch or launch, if any windows are open that would misbehave otherwise.

Edit 3: Another thing. Someone suggested to add this:

yabai -m signal --add event=application_front_switched action="yabai -m window --sub-layer normal"

I suppose this probably applies this rule to an applications windows whenever they become front, thus also fixing the issue. If I understand correctly, this might be a bit of overkill (though would work), and applying the rules to old windows just once would suffice.

@seonjunn
Copy link
Author

Sorry for the late reply.
Adding yabai -m rule --add app=".*" sub-layer=normal in the config definitely did work.
Thanks for the detailed description @shrugalic .

For those who are not familiar with yabai, I did

  1. Add yabai -m rule --add app=".*" sub-layer=normal in the yabairc file.
  2. Run yabai --restart-service to restart the service.
  3. Run yabai -m rule --apply to apply it to already opened windows.

However just out of curiosity, shouldn't this front-app-gets-focus behavior be default without any additional config?
What is the philosophy under this design?

@koekeishiya
Copy link
Owner

koekeishiya commented Mar 29, 2024

The reasoning is that floating windows specifically should always be in front of tiled windows. This is very common with Linux window managers, and I also personally prefer that functionality. The motivation is that when floating windows are mixed alongside tiled windows in a managed space, the floating window usually has one of the following purposes:

a) temporary window that the user needs to interact with before it can be closed/moved away/minimized
b) window that should remain visible while work happens in some other window
c) dialog/pop-up window that requires attention

Very rarely in my opinion does it make sense to allow this window to get hidden behind the grid of managed windows.
If you want the window to go away without closing it, either move it to the side so it does not block the windows that you are working in, change its opacity, minimize it, move it to some other workspace, or un-float it to make it part of the grid.

Now I agree that this is opinionated, which is why it can be disabled fairly trivially in the user config.

@seonjunn
Copy link
Author

Got your point. Fair enough 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Community help appreciated question Request for information or help, not an issue
Projects
None yet
Development

No branches or pull requests

6 participants
@koekeishiya @seonjunn @shrugalic @jpsummer @benkoppe and others