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

MacOS Blurred Background #1520

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

SophiaSaiada
Copy link

@SophiaSaiada SophiaSaiada commented Dec 17, 2024

Partially solving issue #280

Adding a simple blurred background on MacOS.
I think it should be the default behavior, but maybe it should be configurable.
It plays nice with the other configurations, such as opacity, transparentMode and miniBreakColor.

I also added support to opacities below 0.0392156863 (=10/255), see the comment in the Review page.

Screenshot (the buttons at the top left side of the window were like that before my change, I assume it's like that when running from source):
image

@@ -1064,7 +1077,7 @@ function calculateBackgroundColor (color) {
if (settings.get('transparentMode')) {
opacityMultiplier = settings.get('opacity')
}
return color + Math.round(opacityMultiplier * 255).toString(16)
return color + Math.round(opacityMultiplier * 255).toString(16).padStart(2, '0')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if opacity is zero, the output will be "#ffffff0", which is an invalid color code.
The opacity part should always have exactly 2 digits.

@SophiaSaiada SophiaSaiada changed the title MacOS Vibrancy MacOS Blurred Background Dec 17, 2024
@hovancik
Copy link
Owner

Is this supported by other OSes? Seems like macOS only: https://www.electronjs.org/docs/latest/api/browser-window#winsetvibrancytype-macos

I want the app behavior to be same across platforms.

@SophiaSaiada
Copy link
Author

Is this supported by other OSes? Seems like macOS only: https://www.electronjs.org/docs/latest/api/browser-window#winsetvibrancytype-macos

I want the app behavior to be same across platforms.

Firstly, thanks for your reply and your awesome work in genral!

It's not supported by other OSes.

A cross-platform solution will be much more complicated.
It will probably include an external library and won't be a native solution, resulting on excessive resources usage for that blurring effect.

Stretchly already has a non cross-platform feature - do-not-disturb doesn't work on MacOS.

I recently found a similar paid app, called LookAway. One of their two strengths, compared to Stretchly, is that they have this beautiful blur effect, and that they have a good meetings detection.
The second feature will be far more complicated to implement/fix, so I try to at least level Stretchly up with them in the visual aspect.

Anyway, I don't have a PC or a linux-based computer, so I won't be able to code/test other OSes.

@hovancik
Copy link
Owner

Well DND was supported until Apple changed things and I am not able to detect it anymore.

Anyway, I think if we have this as advanced option with default to false, I can merge the PR. Seems like for windows they have similar with acrylic win.setBackgroundMaterial(material)

@SophiaSaiada
Copy link
Author

Ok, fair point :)

An advanced option sounds amazing, I'll work on it on the weekend.

Sure, I can try using the counterpart Windows' option, but I'll need someone else to test it.

@hovancik
Copy link
Owner

Great, if you can try adding Windows as well, I can test it. I will see if anything can be done on Linux as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants