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 setting to control Acrylic "Blur" in addition to opacity #1753

Closed
zadjii-msft opened this issue Jul 1, 2019 · 73 comments
Closed

Add setting to control Acrylic "Blur" in addition to opacity #1753

zadjii-msft opened this issue Jul 1, 2019 · 73 comments
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@zadjii-msft
Copy link
Member

Pretty much the title.

Right now we're only using the default blur amount.

@zadjii-msft zadjii-msft added Help Wanted We encourage anyone to jump in on these. Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Area-Settings Issues related to settings and customizability, for console or terminal Product-Terminal The new Windows Terminal. Issue-Task It's a feature request, but it doesn't really need a major design. labels Jul 1, 2019
@zadjii-msft zadjii-msft added this to the Terminal v1.0 milestone Jul 1, 2019
@ghost ghost added the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jul 1, 2019
@mdtauk
Copy link

mdtauk commented Jul 1, 2019

Opacity slider, with a toggle for turning Acrylic on or off, would also work

@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jul 2, 2019
@DHowett-MSFT
Copy link
Contributor

Yanking the triage tag. This is a known amount of work that we just need to do.

@zadjii-msft
Copy link
Member Author

zadjii-msft commented Jul 3, 2019

This might be impossible...

When I filed this issue I mistakenly thought there was a "Blur" property on the AcrylicBrush, but that doesn't look like it's exposed at all. See its page on MSDN.

And looking at this issue, it looks like this might just be impossible, for security reasons.

@kobenauf
Copy link

kobenauf commented Jul 4, 2019

In this vein, I would like two independent properties to set acrylic values for when the window is in the foreground and when it is in the background. For example, I would like the window to be at 90% opacity when the window has focus, and 70% opacity when it does not.

@KylePreuss
Copy link

For clarification, would this allow transparency of the window without the blurring (i.e. act like cmd and PS)? It would be great to be able to read text behind the window.

@iamakulov
Copy link
Contributor

iamakulov commented Jul 23, 2019

When I filed this issue I mistakenly thought there was a "Blur" property on the AcrylicBrush, but that doesn't look like it's exposed at all. See its page on MSDN.

Isn’t that controlled by TintOpacity? https://docs.microsoft.com/en-us/windows/uwp/design/style/acrylic#custom-acrylic-brush

I guess this is what most people (or, at least, me) mean when talking about changing the blur level.

@wjk
Copy link

wjk commented Aug 11, 2019

I have found (at least one) way to accomplish this effect, but not via UWP. The really old, Vista-era API DwmEnableBlurBehindWindow, if called on Windows 10, changes the window background to a semi-transparent black, without a blur. How ironic given the function’s name, huh? AFAICT, this doesn’t present any security issues, as the app cannot read the contents of the background shown, as it is processed entirely within dwm.exe.

That being said, wouldn’t we be able to use SetLayeredWindowAttributes on the root HWND, just as conhostV2 does? As I understand the docs, this should also affect the child windows. If it does so in a way that would be unsatisfactory, we can then use that same function to set the alpha of the child HWNDs to 255 (opaque), then clear the child windows with a transparent color to erase the default background fill. After that we should be able to draw whatever we want on top of the transparent background window. This may take a bit of refactoring of the Cascadia architecture, but I see no reason why it wouldn’t be able to be done. Hope this helps!

@rkitover
Copy link
Contributor

To add my 2 cents, I would really like the sort of transparency and blur options iterm2 has on Mac. You have regular transparency, and you can add just a bit of blur to reduce eye strain but still make out the background wallpaper or whatever clearly.

The acrylic just looks terrible, and the thing under the window is completely unrecognizable.

@mcgov
Copy link

mcgov commented Sep 24, 2019

@zadjii-msft @DHowett-MSFT We're not limited by the published API as MSFT devs. If you reach out to the library maintainers you can probably get this sorted out, them building their thing in a stupid way doesn't mean we all just have to live with it right?

@fquinner
Copy link

fquinner commented Oct 8, 2019

For the record, this is the final must-have feature for me and window transparency isn't really usable without it imo. At least background image transparency works though, but it's much nicer to be able to see actual apps underneath and / or your real desktop. Terminus, Alacritty and Conemu all manage this (albeit with varying degrees of success).

@jacrys
Copy link

jacrys commented Oct 11, 2019

@zadjii-msft @DHowett-MSFT We're not limited by the published API as MSFT devs. If you reach out to the library maintainers you can probably get this sorted out, them building their thing in a stupid way doesn't mean we all just have to live with it right?

👆🏻 this. so much this.

@qodfathr
Copy link

qodfathr commented Oct 11, 2019

I'll note that https://github.com/goreliu/wsl-terminal handles transparency just fine (and I believe the way the majority of the people here want), so investigating that codebase is probably a reasonable place to start.

** EDIT **

And the transparency option really comes from the underlying https://github.com/mintty/mintty project

@JVimes
Copy link

JVimes commented Dec 12, 2019

I want to read what's behind the window, usually code samples on a web page. In that vein, would it be better to have a hotkey that toggles between blur and non-blur transparency? Aka, turns acrylic off but maintains transparency. It could be push-and-hold or toggle, would be fun to try both.

@zadjii-msft
Copy link
Member Author

This comment (#1375 (comment)) from @Jasonstein might be relevant to this thread:

Hey guys, I am the author of Notepads, this is how I make background acrylic effect "always on" for both title bar and window body of Notepads App: JasonStein/Notepads:src/Notepads/Services/ThemeSettingsService.cs@12940ad#L253

I created the Acrylic brush myself using "AcrylicBackgroundSource.HostBackdrop" with help of UICompositionAnimations library to make my life easier (ref: Sergio0694/UICompositionAnimations).

It is basically creating the brush from scratch using composition APIs (AcrylicBackgroundSource.HostBackdrop + Noise texture).

@TechCiel
Copy link

TechCiel commented Feb 9, 2020

AcrylicBrush API is not the only choice. I'd really like to have an option for simply non-blur opacity, apart from acrylic options. It's strange to drop useful feature of cmd when making this Windows Terminal as cmd-ng.

@b-hayes
Copy link

b-hayes commented Feb 27, 2020

Transparency with no blur at all if that can be done without acrylic even would be great so I don't have to alt-tab mid command to double-check something.

On mac and Linux I use transparent terminal all the time because I am often reading a document or some source code in the window underneath as I type its extremely handy.

Controlling blur would be ideal tho. (on the mac I use 3% blur just to make terminal text stand out without making text behind it hard to read.)

@ghost ghost closed this as completed Feb 16, 2021
@ghost ghost added the Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. label Feb 16, 2021
@zadjii-msft zadjii-msft removed this from the Terminal Backlog milestone Feb 16, 2021
@desmap
Copy link

desmap commented Feb 16, 2021

if you're manually changing the opacity of the entire window, things are gonna be weird

@zadjii-msft Can't follow. It depends very much on the transparency level which @cblake777's solution allows to be set granularly. In your examples in the other issue your transparency is way too low, so ofc it looks bad, no surprise. Also that you call it "vintage-style" doesn't make sense to me—this is exactly how users want transparency, no on and off on focus, no mandatory blur, no random opaque backgrounds/tabs/headers, no resource hog, no blurry fonts. If "vintage" is internal MS lingo then it's wrong, detached from your user base and should be changed.

Also multiple panes work like charm, see below.

I am a bit surprised that you downtalk such a brilliant solution, did you try exactly this solution with AHK and @cblake777's script? If not pls do, this solution is amazing, feels more polished than any macOS or Linux terminal and doesn't have any flaw, not a single one. I even use it now for Spotify and some dark browser windows such as Github in dark mode, I am so happy because other than this strange Acrylic mess the new Windows Terminal is awesome, a perfect package and probably the best terminal experience across OSes.

image

@DHowett
Copy link
Member

DHowett commented Feb 16, 2021

downtalk such a brilliant solution

doesn't have any flaw

image

image

I cannot see a single flaw, because I cannot see the application. We need a better solution because we want just the terminal part of Terminal to be transparent.

@desmap
Copy link

desmap commented Feb 16, 2021

@DHowett in your examples the transparency level is much too low, ofc it looks bad, did you read my prior comment? I am just repeating myself. Did you try the granular script from @cblake777 Btw, no need to get confrontative. I am a big fan of your work.

@DHowett
Copy link
Member

DHowett commented Feb 16, 2021

I did -- that's actually from cblake777's script! 😄

@desmap
Copy link

desmap commented Feb 16, 2021

then try to set the TLevel higher, eg above 200 or even higher depending on the window and background(s) 😀

@cblake777
Copy link

cblake777 commented Feb 16, 2021

I don't disagree @DHowett that there certainly could be better solutions, but I also agree with @desmap that it looks like you need to adjust the transparency level to compensate. That's why my AHK script has the additional key combos for CTRL+Win+- and CTRL+Win++ so that I can adjust the transparency level of each window on the fly as needed. It's not a perfect solution, but for me it is a good solution, and it works really well right now.

EDIT: I should also say that I don't use the command pallet as I'm more of a hotkey driven user, so I fully admit that I may not run into the same problems you do.

@adicadi
Copy link

adicadi commented Mar 30, 2021

I completely agree with @desmap that the AHK solution has completely changed my workflow and Windows Terminal is now my go-to terminal when I'm using Windows. I added a bit to the AHK script so that I could adjust the transparency on the fly with a couple additional key combos. The approach is so handy I've found myself using for a lot of different things, not just Windows Terminal.

TLevel = 180

#^Esc::
    WinGet, CurrentTLevel, Transparent, A
    If (CurrentTLevel = OFF) {
        WinSet, Transparent, %TLevel%, A
    } Else {
        WinSet, Transparent, OFF, A
    }
return

 SetTransparency:
    WinGet, CurrentTLevel, Transparent, A
    WinSet, Transparent, %TLevel%, A
return

#^=::
    TLevel += 10
    If TLevel >= 255
    {
        TLevel = 255
    }
    
    Gosub, SetTransparency
return

#^-::
    TLevel -= 10
    If TLevel <= 0
    {
        TLevel = 0
    }
    
    Gosub, SetTransparency
return

how to use this script ???

@JamesDBartlett3
Copy link

how to use this script ???

@adicadi: Copy the text to your clipboard, open a text editor, paste the text, save it as a .AHK file, then open it using AutoHotkey.

If you want to make it run automatically when you login, create a shortcut to your .AHK file, cut the shortcut to your clipboard, type shell:startup in the Windows Explorer location bar, hit Enter, and paste the file there.

@cblake777
Copy link

Note that the part I pasted was not the entire script, only a portion. The entire script is found as an attachment to a later post (#1753 (comment)).

@lilonpro
Copy link

Everytime I open terminal I need to do Win+ctrl+ESC. Is there a way to run this automaticly?

@b-hayes
Copy link

b-hayes commented Aug 11, 2021

Everytime I open terminal I need to do Win+ctrl+ESC. Is there a way to run this automaticly?

You might have to go look at AHK docs or forums it can pretty much do anything. Would probably only be one line in your script to run the set transparency function when the terminal gains focus.
Quick google search got me here hope that helps: https://autohotkey.com/board/topic/84069-running-code-on-window-focusunfocus/

@darkguy2008
Copy link

darkguy2008 commented Oct 24, 2021

So the MS bot closed this issue with no reason because it's a mindless bot, yet the issue is still ongoing as of date. I wanted to set the terminal transparent and I get a horrible blur along with the acrylic that I want to remove, I don't want the blur, I just want the window transparency while keeping the titlebar/borders opaque and no weird AHK hacks or 3rd-party terminals.

I disagree this issue should be closed, such a feature like this has been available in linux terminals ever since compwiz or other compositors were available almost two decades ago.

Is there any progress regarding this feature, officially from MS?

@fquinner
Copy link

So the MS bot closed this issue with no reason because it's a mindless bot, yet the issue is still ongoing as of date. I wanted to set the terminal transparent and I get a horrible blur along with the acrylic that I want to remove, I don't want the blur, I just want the window transparency while keeping the titlebar/borders opaque and no weird AHK hacks or 3rd-party terminals.

I disagree this issue should be closed, such a feature like this has been available in linux terminals ever since compwiz or other compositors were available almost two decades ago.

Is there any progress regarding this feature, officially from MS?

Its available in the latest preview build now. But yes a comment here to say that would have been nice. I guess this is that comment now :).

@zadjii-msft
Copy link
Member Author

@darkguy2008 If you'd read the thread, you'd find my post where I closed this issue, where I link it to #603 as a duplicate. That thread was closed by a PR, which you'll note was released in 1.12, which you can also find out about in the release notes, or reading the release blog post.

Would you like something more official than that?

@darkguy2008
Copy link

darkguy2008 commented Oct 24, 2021

So the MS bot closed this issue with no reason because it's a mindless bot, yet the issue is still ongoing as of date. I wanted to set the terminal transparent and I get a horrible blur along with the acrylic that I want to remove, I don't want the blur, I just want the window transparency while keeping the titlebar/borders opaque and no weird AHK hacks or 3rd-party terminals.
I disagree this issue should be closed, such a feature like this has been available in linux terminals ever since compwiz or other compositors were available almost two decades ago.
Is there any progress regarding this feature, officially from MS?

Its available in the latest preview build now. But yes a comment here to say that would have been nice. I guess this is that comment now :).

Oh I didn't know that, I agree that a comment would've been nice. Thanks for the input!

@darkguy2008 If you'd read the thread, you'd find my post where I closed this issue, where I link it to #603 as a duplicate. That thread was closed by a PR, which you'll note was released in 1.12, which you can also find out about in the release notes, or reading the release blog post.

Would you like something more official than that?

Well, in the post where you closed the issue I didn't see anything about "it's been released". It's just that "we're going to track this to a single issue because too many yadda yadda duplicate yadda yadda". I wasn't even aware the PR meant that the feature was released. The blog post doesn't say anything about the opacity field (new in the 1.12, per your link) and what's more, it was released in the preview build.

I've been stuck in LTSC land for a long time, and just gave a try at Windows 11 today... Considering the time it's been in development since then I had expected this feature to be available already... And although I'm very happy to know it finally made to the preview release (and hopefully to the public releases soon)...

I'm afraid to say that, no, it wasn't that obvious as you think it was. I came here from a google search looking for "how to remove acrylic blur from windows terminal" so 🤷🏻‍♂️ my bad!

Edit: I just gave a try at the preview build and it's light years from the stock version provided in Windows 11 as-is. IMO this should be the default already, it even has an UI for the settings so I didn't even have to touch the JSON file to achieve the transparency effect I wanted. Amazing, thank you!

@b-hayes
Copy link

b-hayes commented Nov 1, 2021

@darkguy2008 I can't go win11 just yet no time to risk my dev env breaking atm. Can you tell me, does it actually let you control the Acrylic Blur amount or is it only controlling transparency. I suspect from the linked PR only turning blur off entirely was addressed.

IF that's the case then this issue isn't technically resolved.

@darkguy2008
Copy link

darkguy2008 commented Nov 1, 2021

@darkguy2008 I can't go win11 just yet no time to risk my dev env breaking atm. Can you tell me, does it actually let you control the Acrylic Blur amount or is it only controlling transparency. I suspect from the linked PR only turning blur off entirely was addressed.

IF that's the case then this issue isn't technically resolved.

Yeah sure, the new Preview version allows you to control both things. I'm very happy now:

image

The only issue I see is that once you change the slider, the "Enable acrylic" toggle turns on, but you can just toggle it off once you're happy with the opacity :)

I moved my entire dev env to Win11 and can't be happier. It only bugged on me once with the task manager and explorer icons flashing, but it was fixed after a reboot, so I recommend switching. The OS feels faster/snappier, too.

@rkitover
Copy link
Contributor

rkitover commented Nov 1, 2021

This is not working for me. The transparency works in the powershell commandline, but once I open vim, where I do not change the background color, it changes to solid black. While the autohotkey script works fine.

@rkitover
Copy link
Contributor

rkitover commented Feb 2, 2022

I did some more testing with vim and Neovim with this, and it works fine in Neovim but not in regular vim.

I have this in my ~/.vimrc:

if !has('gui_running') && match($TERM, "screen") == -1
  set termguicolors
  au ColorScheme * hi Normal ctermbg=0
endif

This enables 24 bit color and sets the background to black.

In Neovim the background is transparent, while in regular vim the background is solid black except for the region right under the statusbar.

My screenshot program is broken right now for some reason.

@at-pyrix
Copy link

I completely agree with @desmap that the AHK solution has completely changed my workflow and Windows Terminal is now my go-to terminal when I'm using Windows. I added a bit to the AHK script so that I could adjust the transparency on the fly with a couple additional key combos. The approach is so handy I've found myself using for a lot of different things, not just Windows Terminal.

TLevel = 180

#^Esc::
    WinGet, CurrentTLevel, Transparent, A
    If (CurrentTLevel = OFF) {
        WinSet, Transparent, %TLevel%, A
    } Else {
        WinSet, Transparent, OFF, A
    }
return

 SetTransparency:
    WinGet, CurrentTLevel, Transparent, A
    WinSet, Transparent, %TLevel%, A
return

#^=::
    TLevel += 10
    If TLevel >= 255
    {
        TLevel = 255
    }
    
    Gosub, SetTransparency
return

#^-::
    TLevel -= 10
    If TLevel <= 0
    {
        TLevel = 0
    }
    
    Gosub, SetTransparency
return

For anyone not getting what #^Esc is, it's Win + Ctrl + Esc

@GatoVuelta
Copy link

What about acrylic blur amount? The default Windows acrylic blur is a bit too high so we can't really appreaciate the background elements when the acrylic is enabled, and mixing transparency with the high blur amount gives not enough satisfying results:

(Default acrylic)
WindowsTerminal_yTK74Sgb8L

(No Acrylic, Using Terminal settings bg transparency)
WindowsTerminal_4S60C7GjCs

(No Acrylic, Using AHK transparency)
WindowsTerminal_rde0N8Qbjh

(Acrylic, Using AHK transparency)
WindowsTerminal_wWe1IHoosl

An expected result would be like this (Tweaked Neovim):
msedge_F3x1F2G3O5

@rkitover
Copy link
Contributor

rkitover commented May 1, 2022

@Komodroid nice screenshots, I would say that the acrylic is a bit too blurry, try iterm2 on a mac with a small amount of blur, it lets you focus on the foreground but still have the background be distinct and visible.

@b-hayes
Copy link

b-hayes commented May 1, 2022

This issue shouldn't have been closed as controlling the blur amount is much more ideal than simply having transparency.

Also, that's the point of this question.
#603 is NOT the same thing at all.

While I appreciate that WT can now be transparent with clear text, we are still working around the fact that acrylic blur is way too much and we need to turn the blur amount down.

The best so far is on macOS terminal. Having say 3% blur is perfect for keeping the terminal crisp and distinct from the still readable text behind it.

@VladimirPal
Copy link

If someone looking autoscript v2 script for transparency switching, script which works for me well:

#Requires AutoHotkey v2.0
TLevel := 180
TMode := "full" 
WS_EX_LAYERED := 0x80000
LWA_ALPHA := 0x2

#^Esc::ToggleTransparency()  ; Ctrl + Win + Esc
#^=::IncreaseTransparency()  ; Ctrl + Win + =
#^-::DecreaseTransparency()  ; Ctrl + Win + -

ToggleTransparency() {
    global TMode
    hwnd := WinExist("A")
    EnsureLayered(hwnd)
    if (TMode = "full") {
        TMode := 'manual'
        SetTransparency(hwnd, TLevel)
    } else {
        TMode := 'full'
        SetTransparency(hwnd, 255)
    }
}

IncreaseTransparency() {
    global TLevel
    TLevel += 10
    if (TLevel > 255)
        TLevel := 255
    
    SetTransparency(WinExist("A"), TLevel)
}

DecreaseTransparency() {
    global TLevel
    TLevel -= 10
    if (TLevel < 0)
        TLevel := 0
    
    SetTransparency(WinExist("A"), TLevel)
}

SetTransparency(hwnd, Level) {
    global TLevel
    EnsureLayered(hwnd)
    if (hwnd != 0) {
        DllCall("SetLayeredWindowAttributes", "ptr", hwnd, "uint", 0, "uchar", Level, "uint", LWA_ALPHA)
    }
}

EnsureLayered(hwnd) {
    exStyle := DllCall("GetWindowLongPtr", "ptr", hwnd, "int", -20, "UPtr")
    if ((exStyle & WS_EX_LAYERED) != WS_EX_LAYERED) {
        DllCall("SetWindowLongPtr", "ptr", hwnd, "int", -20, "UPtr", exStyle | WS_EX_LAYERED)
    }
}

@zadjii-msft
Copy link
Member Author

That seems.... kinda like overkill, for something there are already actions for in the Terminal itself:

3d0dfdce-b7d4-4e54-ae89-d72e21b6563e

Or to any value in between

@VladimirPal
Copy link

VladimirPal commented Jan 22, 2024

That seems.... kinda like overkill, for something there are already actions for in the Terminal itself.

Agree. But set background opacity using terminal actions will not make a background transparent in combination with enabled acrylic material. With autoscript you will achieve window fogging effect. Plus it works with all windows.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Area-TerminalControl Issues pertaining to the terminal control (input, selection, keybindings, mouse interaction, etc.) Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests