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

Merged
merged 6 commits into from
Dec 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,17 @@ function startBreakNotification () {
updateTray()
}

function getBreakWindowVibrancyOptions () {
if (settings.get('transparentMode') || settings.get('fullscreen') || process.platform !== 'darwin') {
return {}
}

return {
vibrancy: 'hud',
visualEffectState: 'active'
}
}

function startMicrobreak () {
// don't start another break if break running
if (microbreakWins) {
Expand Down Expand Up @@ -704,6 +715,7 @@ function startMicrobreak () {
show: false,
backgroundThrottling: false,
transparent: true,
...getBreakWindowVibrancyOptions(),
backgroundColor: calculateBackgroundColor(settings.get('miniBreakColor')),
skipTaskbar: !showBreaksAsRegularWindows,
focusable: showBreaksAsRegularWindows,
Expand Down Expand Up @@ -852,6 +864,7 @@ function startBreak () {
show: false,
backgroundThrottling: false,
transparent: true,
...getBreakWindowVibrancyOptions(),
backgroundColor: calculateBackgroundColor(settings.get('mainColor')),
skipTaskbar: !showBreaksAsRegularWindows,
focusable: showBreaksAsRegularWindows,
Expand Down Expand Up @@ -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
Contributor 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.

}

function loadIdeas () {
Expand Down