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

Feature Request: Ability to blur non-opaque windows #1614

Open
bigpick opened this issue Feb 3, 2022 · 14 comments
Open

Feature Request: Ability to blur non-opaque windows #1614

bigpick opened this issue Feb 3, 2022 · 14 comments
Labels
enhancement New feature or request PR-welcome Wez doesn't have plans to work on this, but will accept a PR if someone feels motivated!

Comments

@bigpick
Copy link

bigpick commented Feb 3, 2022

Is your feature request related to a problem? Please describe.
No, purely new aesthetic feature.

Describe the solution you'd like
Ability to toggle on and off a customizable blur on windows with some amount of opacity (i.e != 1.0).

The ability to enable a blur via a toggle would be good, but the ability to do so and also specify the radius or "amount" of blur would be awesome.

Describe alternatives you've considered

  • iTerm2 (which I switched off of to wezterm a few months back, and have enjoyed the switch, this feature being the only main thing I've noticed that I used to use daily that isn't present):

    Blur
    If selected, the window background is blurred provided the background has some transparency. Selecting a large radius will blur the background more, but (especially on Retina displays) comes with a performance penalty.

  • alacritty
  • mac native Terminal application

I tried looking through the docs/source to make sure I just wasn't missing it, and the only thing I seemed to notice was this old previous wezterm issue which addresses transparency, but not blur, which is what this is requesting.

Additional context

  • macOS operating system

  • version:

wezterm 20220126-105230-0c6b4e26
  • Not really relevant, but currently toggle transparency like so:
local wezterm = require 'wezterm';

wezterm.on("toggle-opacity", function(window, pane)
  local overrides = window:get_config_overrides() or {}
  if not overrides.window_background_opacity then
    overrides.window_background_opacity = 0.8;
  else
    overrides.window_background_opacity = nil
  end
  window:set_config_overrides(overrides)
end)
@bigpick bigpick added the enhancement New feature or request label Feb 3, 2022
@bigpick bigpick changed the title Feature Request: Blur non-opaque windows Feature Request: Ability to blur non-opaque windows Feb 3, 2022
@wez
Copy link
Owner

wez commented Feb 3, 2022

This needs to be considered on multiple platforms to make sure that we get the right configuration for it.

https://stackoverflow.com/questions/41475551/how-can-i-use-nsvisualeffectview-to-blend-window-with-background suggests that there is something relatively straight forward to try to apply, however, I don't know how that will interact with OpenGL.

It is possible that the two things cannot be combined.

On WIndows, there may be a thing possible with the DWM api.

On X11: there is not single API and whether this is possible depends on the Window manager and its compositing abilities.
On Wayland: I'm not aware of a way to do this.

I don't have any immediate plans to look at this, but would be happy to shepherd a PR for macOS or Windows as a starting point if someone has time to invest here.

@wez wez added the PR-welcome Wez doesn't have plans to work on this, but will accept a PR if someone feels motivated! label Feb 3, 2022
@Avimitin
Copy link

If an application want blur in KDE wayland, we could use this protocol to tell Kwin: https://invent.kde.org/libraries/plasma-wayland-protocols/-/blob/master/src/protocols/blur.xml.

@athre0z
Copy link
Sponsor

athre0z commented Nov 27, 2022

Inspired by the comment above and this blog article, I came up with this config to get blur on KDE X11 without any changes in wezterm:

wezterm.on("window-focus-changed", function()
  os.execute('xdotool search -classname org.wezfurlong.wezterm | xargs -I{} xprop -f _KDE_NET_WM_BLUR_BEHIND_REGION 32c -set _KDE_NET_WM_BLUR_BEHIND_REGION 0 -id {}')
end)

@Gkirito
Copy link
Contributor

Gkirito commented Feb 19, 2023

Hello, on macOS Ventura, I did it by NSVisualEffectView(macOS 10.10+)
image-20230219qWtlvHaU@2x

@idr4n
Copy link

idr4n commented Feb 19, 2023

@Gkirito Could you elaborate on how to use NSVisualEffectView? Thanks in advance!

@Gkirito
Copy link
Contributor

Gkirito commented Feb 19, 2023

@Gkirito Could you elaborate on how to use NSVisualEffectView? Thanks in advance!

This PR #3136

@kingavatar
Copy link
Contributor

Hey Guys, for windows I have added a PR for acrylic, mica background for windows os.

Acrylic:

acrylic

Mica:

mica

Tabbed(Mica Alt):

tabbed

wez added a commit that referenced this issue Apr 17, 2023
@wez
Copy link
Owner

wez commented Apr 17, 2023

Current status:

@bertin0
Copy link

bertin0 commented Jun 6, 2023

On Gnome Wayland, there is the Blur my shell extension which provides the ability to blur the background of applications with transparency, but at the moment there is a bug (aunetx/blur-my-shell#285) which seems to still affect Wezterm which makes blur go to foreground due to some edge cases. I just wrote them a comment to investigate this particular, but maybe this could be looked into on the wezterm side if you had the time. This works fine on Alacritty for example. Nevermind, this seems to be fixed on newer versions of gnome like on arch, I guess i should update my work laptop's ubuntu.

It appears that it also offers a way for application to request blur by setting some window hints, maybe this could be used in wezterm to enable it by default easily.

@wez
Copy link
Owner

wez commented Jun 6, 2023

offers a way for application to request blur by setting some window hints,

Wayland doesn't have a hints concept, so that will only work on X11 mutter

@baduhai
Copy link

baduhai commented Jul 7, 2023

For kwin_wayland (KDE Plasma compositor) there is the blur protocol.

@Avimitin
Copy link

If an application want blur in KDE wayland, we could use this protocol to tell Kwin: invent.kde.org/libraries/plasma-wayland-protocols/-/blob/master/src/protocols/blur.xml.

For KDE wayland, this protocol can now be interacted with crate wayland-protocol-plasma

@ekorchmar
Copy link
Contributor

I am trying to look into this and implement it for Kde/Wayland. I am currently stuck at trying to instantiate a OrgKdeKwinBlurManager struct. I understand that I need to implement it either in corresponding state block or in the window itself.

So would the proper way be to implepement OrgKdeKwinBlurManager in state.rs, and call it's .create implementation somewhere from window.rs?

I have no experience programming for wayland protocol, and I can not find any Rust blur implementations I could reference anywhere, but I really want to figure it out.

@ekorchmar
Copy link
Contributor

Just FYI anyone watching this for KDE implementation, I got stuck with it and can not currently dedicate any time to research this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR-welcome Wez doesn't have plans to work on this, but will accept a PR if someone feels motivated!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants