FelixKratz / SketchyBar

A highly customizable macOS status bar replacement
https://felixkratz.github.io/SketchyBar/
GNU General Public License v3.0
5.45k stars 85 forks source link

Blur doesnt work with dynamic wallpaper apps #395

Closed FormalSnake closed 11 months ago

FormalSnake commented 11 months ago
Screenshot 2023-09-05 at 10 12 15 Screenshot 2023-09-05 at 10 13 17

It basically keeps flickering between transparent and non transparent.

FormalSnake commented 11 months ago

And when I try to record it it works fine lmao, I stop recording and it bugs out again

FelixKratz commented 11 months ago

Could you explain it a bit more wordy? I think I dont understand what exactly the problem is. Does the bars background stay and the content disappears or does the entire bar become invisible?

It seems this dynamic wallpaper app is doing something strange, maybe it is because of the window ordering. It could be that sketchybar and your dynamic wallpaper are figthing for the window level, could you try:

sketchybar --bar topmost=window
FormalSnake commented 11 months ago

so basically, the bar starts flickering with being translucent or not, and when I executed the command you provided me, the bar bugs out a lot less now

FelixKratz commented 11 months ago

So it disappears completely and then reappears? I think it must be because of the wallpaper app doing some window ordering that they should not be doing... Could you quantify "a lot less"? Once a second or once a minute or never? you could try

sketchybar --bar topmost=on

this makes sketchybar the topmost overall window and nothing should be able to draw over it (not even the macOS bar).

I think this is not something I can address in sketchybar, it has to do with how this wallpaper app orders itself and other apps I think.

FormalSnake commented 11 months ago
Screenshot 2023-09-05 at 10 12 06

It doesnt appear on screenshots, but you can see the background of the bar is translucent and has blur, but it keeps changing to it having a solid background. The background appears solid because it does not seem to see the wallpaper behind it.

FormalSnake commented 11 months ago

and it is very inconsistent between timing, sometimes a minute, sometimes seconds, etc.

FormalSnake commented 11 months ago

no other app has this issue, for example iTerm or Arc's background blur look correct with the moving wallpaper

FormalSnake commented 11 months ago

https://github.com/FelixKratz/SketchyBar/assets/90651091/83eb76e0-d796-4837-a7f1-1750ed20ad6b

and it does not bug out when recording.

FelixKratz commented 11 months ago

Does it look like this: https://github.com/koekeishiya/yabai/issues/1665 ?

FormalSnake commented 11 months ago

It looks similar to the second one they show

FelixKratz commented 11 months ago

It is probably the same problem, it has to do with the transparency and blur and is a side effect of using SLSSetWindowBackgroundBlurRadius instead of a CABackdropLayer.

You could simply disable transparency and blur to fix the problem.

FormalSnake commented 11 months ago

I could but it would not look nearly as good tho. Could the app still work if you use CABackdropLayer instead? what are the disadvantages?

FelixKratz commented 11 months ago

The problem is that we are using the CGContext of the window to draw all contents, using a CABackdropLayer would include creating a window surface on which this backdrop layer is drawn. Unfortunately, the CGContext is below all surfaces of the window such that the entire drawing had to be done in surfaces with CALayers that would order above the backdrop layer. This is a problem, because I can not draw with the CGContext* functions into a CALayer and the entire drawing logic had to be redone with CALayers. If it was possible to order the surfaces below the CGContext then this would be no problem, but I have not found a way to do that.

So you see it is not impossible, but not feasible for me to do.

FormalSnake commented 11 months ago

Well, someone might come across this issue who is willing to fix this someday. For now I will not use the wallpaper app.

FelixKratz commented 11 months ago

There is one thing you could try: Replace all occurrences of SLSSetWindowBackgroundBlurRadius with SLSSetWindowBackgroundBlurRadiusWithOpacityHint and compile and run the program. It might not do anything, but it is worth a try.

FormalSnake commented 11 months ago

sure, this will be my first time compiling C tho, so I might require assistance later

FormalSnake commented 11 months ago

I compiled it succesfully but how do I run it?

FelixKratz commented 11 months ago

If you are in the sketchybar source code folder with your terminal just run:

brew services stop sketchybar
./bin/sketchybar

This stops the brew version of sketchybar and starts the one compiled from source with your changes.

Btw, does the bugging occur when setting:

sketchybar --bar blur_radius=0
FormalSnake commented 11 months ago

the bugging stops when I do blur_radius=0

FelixKratz commented 11 months ago

the bugging stops when I do blur_radius=0

Ah thats interesting, so it really is only the blur that causes this...

FormalSnake commented 11 months ago
```shell
./bin/sketchybar

After doing this part, the bugging still occurs

FormalSnake commented 11 months ago

the SLSSetWindowBackgroundBlurRadiusWithOpacityHint