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

Add Windows blur #56

Merged
merged 5 commits into from Feb 15, 2022
Merged

Add Windows blur #56

merged 5 commits into from Feb 15, 2022

Conversation

rdbende
Copy link
Member

@rdbende rdbende commented Feb 15, 2022

New feature to blur the window background on Windows.

This API is kinda broken in Windows itself, and Microsoft hasn't documented it anywhere.

Some documentation

w.enable_bg_blur(tint, tint_opacity, effect)

arg type description default
tint tukaan.Color Color used to color the background. If None, current window bg color is used. Current window bg
tint_opacity float How much to color the background, on a range between 0 and 1. 0 = no color (transparent), 1 = only color (opaque) 0.2
effect tukaan.DwmBlurEffect Sets what effect to use 👇 DwmBlurEffect.BLUR (blur + tint with opacity)
DwmBlurEffect (it's an enum) attributes

DwmBlurEffect.DISABLED           -> no effect
DwmBlurEffect.OPAQUE_COLOR       -> tint only
DwmBlurEffect.TRANSPARENT_COLOR  -> tint with opacity
DwmBlurEffect.BLUR               -> blur + tint with opacity
DwmBlurEffect.ACRYLIC            -> acrylic blur + tint with opacity

w.disable_bg_blur()

Remove blur effect.

Example

import tukaan

with tukaan.App(title="Nice little blur") as app:
    app.enable_bg_blur(tint=tukaan.Color("#6667ab"), tint_opacity=0.4)
    tukaan.Timeout(3, app.disable_bg_blur).start()

Small hack (not really a hack by now)

How to make acrylic effect?

For acrylic effect you can use the effect argument, and set it to tukaan.DwmBlurEffect.ACRYLIC. This acrylic effect is available since Windows 10 1803, but it's incredibly laggy on all Windows 10 systems. Works well on Windows 11 though.

@sumeshir26
Copy link

This is reallay cool, now I know how to make th tilebar work after unmaximizing!

@rdbende rdbende merged commit a53a4aa into master Feb 15, 2022
@rdbende rdbende deleted the 2022-02-15 branch April 29, 2022 19:41
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.

None yet

2 participants