yabai icon indicating copy to clipboard operation
yabai copied to clipboard

Border flicker on Catalina and yabai v4

Open samuellvicente opened this issue 2 years ago • 9 comments

Upon updating to the latest v4.0.0 version I started noticing border flicker when I change focus between windows.

Here is a short video of what I'm experiencing:

https://user-images.githubusercontent.com/22838433/164023780-56a31b1d-8988-4f96-b091-c515794541a7.mov

In slow motion:

https://user-images.githubusercontent.com/22838433/164024830-025fb66a-b77c-4e13-bcb0-0a34d22048fb.mov

It seems that in between the drawing of the unfocused border and the focused border the border disapears and so it seems to flicker.

Anyone else experiencing this?

It also happens when I only have firefox open and I type, may be an unrelated issue but it's very distracting.

MacOS Catalina 10.15.7

Yabai v4.0.0 with sa

Btw, thank you so much for this software, without it, using MacOS would be insane.

samuellvicente avatar Apr 19 '22 14:04 samuellvicente

The flickering happens because the border is actually being occluded by the window when it gains focus, but we detect that shortly after and bring the border back to front again. Not really sure what else can be done that will also allow the border to respect z-ordering of other windows.

koekeishiya avatar Apr 19 '22 15:04 koekeishiya

I see, so this is intended behaviour?

I reinstalled the 3.3.10 version just to make sure this did not happen before and it does not.

samuellvicente avatar Apr 19 '22 16:04 samuellvicente

The border system in v3.3.10 does not work in macOS Monterey so it was rewritten in v4.0.0; the new version has this side effect, at least for now. I spent some time trying to see if if was possible to have these systems live side-by-side and interchangeable through a config option, but that was not really possible in a way that I found acceptable.

koekeishiya avatar Apr 19 '22 18:04 koekeishiya

I'm going to ask a slightly unrelated question here, @samuellvicente how have you manage to square your window corners?

shot-codes avatar Apr 20 '22 09:04 shot-codes

The border system in v3.3.10 does not work in macOS Monterey so it was rewritten in v4.0.0; the new version has this side effect, at least for now. I spent some time trying to see if if was possible to have these systems live side-by-side and interchangeable through a config option, but that was not really possible in a way that I found acceptable.

I see, well, I'll just use v3 then since it has all the features I need. Thanks for your time!

samuellvicente avatar Apr 20 '22 11:04 samuellvicente

I'm going to ask a slightly unrelated question here, @samuellvicente how have you manage to square your window corners?

Hmm, I did nothing, I think it's the default behaviour for the border to be squared.

If your talking about the application windows then I also did nothing, I think there are some hacks you can do but I never tried them.

My border has a width of 5 and it gives the illusion of squaring the corners.

You can check my yabairc in my dotfiles and try my config for yourself.

samuellvicente avatar Apr 20 '22 11:04 samuellvicente

It appears that the new border system could get rid of this visual flicker if it is sped up. My proof of concept version (https://github.com/koekeishiya/yb) does not have this flickering happen.

I am not sure if this is achievable with the version that is integrated into yabai itself, because of overhead caused by synchronisation, as there is a lot more going on than simply "updating window borders".

I'll probably look into this in the future, as I myself find the visual flicker to be rather annoying at times.

koekeishiya avatar Apr 24 '22 13:04 koekeishiya

If borders are drawn below the window, instead of on top of the window, there will be no flickering: https://github.com/FelixKratz/yabai/commit/fb48e7617f7e75d246684b9a3cdce37560f835fe

FelixKratz avatar Aug 26 '22 12:08 FelixKratz

When drawing below it will also have to enclose the window, instead of matching the window frame. This does not work well without padding/gap. A workaround is to include the size of the border frame inside of the node region, and subtract that width from the window itself, but this gets messy in situations where a window enforces min/max size constraints.

koekeishiya avatar Aug 26 '22 13:08 koekeishiya

I think I am going to try this with the workaround of subtraction the border inset from the node region of the window. If a window has min/max size constraints, the border should still be placed properly.

koekeishiya avatar Sep 19 '22 21:09 koekeishiya

@koekeishiya it would be incredible if there the option to use borders in the old limelight style. With rounded corners and enclosing the window rather than being drawn on top. 🙏

I would try myself but I haven't got much experience with MacOS system programming. Either way thanks for the software. It's really great

shot-codes avatar Sep 20 '22 05:09 shot-codes

It has also been problematic for me at times, to have window content obscured by the border being drawn over it.

shot-codes avatar Sep 20 '22 08:09 shot-codes

This will be fixed with the changes being made for #1430

koekeishiya avatar Sep 20 '22 10:09 koekeishiya