-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Allow Opacity to be set differently in both focused and unfocused terminals #15974
Conversation
Would be handy to have tests, so many different permutations to check with Acrylic + Opacity + Mouse Scroll Wheel + Adjusting Opacity through Command Palette |
Made a new PR! |
Ugh there's still some bugs was sure I removed them, one sec ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks and feels great! Tested it out on my machine even :)
Here's some other feedback:
- Please update the docs repo
I'll approve since the comments are pretty small, but please make sure you get to them. Thanks and great work!
// Skip Unfocused Opacity when EnableUnfocusedAcrylic is false | ||
// and Acrylic is true as this results into seeing the opacity going | ||
// from solid to unfocused to focused bug. | ||
bool skipUnfocusedOpacity = !focused && !(!_settings->EnableUnfocusedAcrylic() && UseAcrylic()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool skipUnfocusedOpacity = !focused && !(!_settings->EnableUnfocusedAcrylic() && UseAcrylic()); | |
bool skipUnfocusedOpacity = !focused && (_settings->EnableUnfocusedAcrylic() || !UseAcrylic()); |
Personally, I'd prefer that you De Morgan's law it haha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea there's definitely something real weird with the way the conditionals are worded here that confuses me.
hell it might be easier to say useUnfocusedOpacity = focused && _settings->EnableUnfocusedAcrylic()...
and flip the next statement around...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zadjii-msft Should be good now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The wording of these conditionals has me scratching my head. They might need a bit of re-wording just to make the logic a bit easier to follow, but if the code works, I'm happy to ship it
// Skip Unfocused Opacity when EnableUnfocusedAcrylic is false | ||
// and Acrylic is true as this results into seeing the opacity going | ||
// from solid to unfocused to focused bug. | ||
bool skipUnfocusedOpacity = !focused && !(!_settings->EnableUnfocusedAcrylic() && UseAcrylic()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea there's definitely something real weird with the way the conditionals are worded here that confuses me.
hell it might be easier to say useUnfocusedOpacity = focused && _settings->EnableUnfocusedAcrylic()...
and flip the next statement around...
// and Acrylic is true as this results into seeing the opacity going | ||
// from solid to unfocused to focused bug. | ||
bool skipUnfocusedOpacity = !focused && !(!_settings->EnableUnfocusedAcrylic() && UseAcrylic()); | ||
double newOpacity = skipUnfocusedOpacity ? newAppearance->Opacity() : FocusedOpacity(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually what?
If skipUnfocusedOpacity
: use newAppearance->Opacity
.
else, we shouldn't skip unfocused opacity, and we should use FocusedOpacity
?
That doesn't really seem to make sense, at least not literally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zadjii-msft Should be good now
Hey Mike, I was wondering if you got a chance yet to answer my question: But to be honest I'd really like you to answer this question: |
Thanks Carlos. "Looks and feels great!" xD, I am glad you say that. I actually used to be one of the best (1000) game designers in The Netherlands if I say so myself in 2018, 2019 and there's this concept called Game Feel which is a lot about how things feel. Usually needs lots of player testing before it's good. Glad you like it! Hope the users will like it as well. If you like Game Feel and want to see a fun presentation about it see this: https://www.youtube.com/watch?v=AJdEqssNZ-U I'll look into the docs and comments. Not sure what to add to the docs, let me try something.. |
I think my expectations of you guys may be wrong. I expected Microsoft Engineers would like go over all the possible scenario's when reviewing. in this case try all the various permutations of UseAcrylic , Opacity in Unfocused and Focused mode + all other combinations with Adjust Opacity in Command Palette and Scroll Wheel, etc. Maybe come up with things I missed, like edgecases about the feature (not code stuff). But didn't notice this in 7158 or this one. It seems like your reviewing process is mostly aimed at the code quality? |
@carlos-zamora @zadjii-msft bool useFocusedRuntimeOpacity = focused || (!_settings->EnableUnfocusedAcrylic() && UseAcrylic());
double newOpacity = useFocusedRuntimeOpacity ?
FocusedOpacity() :
newAppearance->Opacity();
_setOpacity(newOpacity, focused); But not sure how to make this clear in a concise way with comments. Essentially there are 2 special things going on that I want to communicate somehow with the comments to make it more clear.
So now here's where it get's unclear for me I think it woud be good to mention something like that this prevents a bug from happening / covers an edge case. This could also be mentioned here: Also I could tell about how EnableUnfocusedAcrylic and Focused and Unfocused Acrylic and Opacity in the docs and provide more clearance there? |
…escribe what the new parameter does also provided clearer comments at other places
@carlos-zamora @zadjii-msft Let me know what you think! I'd be happy to adapt it if needed. Still working on the docs |
Hi Mike, This might be a silly way to do this. Solving 7158 boosted my confidence to start seriously applying to Big Tech Jobs. Can you give me a referral? I rather have a referral from you then someone that doesn’t know me. Also, are there any relevant opportunities at Microsoft that would let me work on this project or similar ones to it? PS: I'll be continuing with the docs part and making a PR for that probably later this week @DHowett @lhecker @carlos-zamora @j4james @PankajBhojwani |
@Jaswir sorry for the silence! We are all heads down preparing for our release on Tuesday. We'll have some more mental bandwidth as a team for discussions and PR reviews after that 🙂 |
Thanks for letting me know! Will unfocused Acrylic be in the release ??? Lots of users want that and would be happy with that, including me. |
@carlos-zamora Updated the docs |
@zadjii-msft Did you get a chance to rereview it yet? It's blocking #15717 |
Hey Dustin, when it's convenient for you. Could you please add this to the next release? I want this in my default windows preview terminal. It would make me very happy :D If it wouldn't be too much effort for you I'd really appreciate it. Thanks in advance. |
…minals (#15974) ## Summary of the Pull Request Closes #11092 Allowing `opacity `to be set differently in both focused and unfocused terminals ## References and Relevant Issues #11092 , references: #7158 ## Detailed Description of the Pull Request / Additional comments ### Allowing Opacity to be set differently in both focused and unfocused terminals: ![unfocused_opacity](https://github.com/microsoft/terminal/assets/15957528/1c38e40b-4678-43ec-b328-ad79d222579f) ![image](https://github.com/microsoft/terminal/assets/15957528/3e3342a8-7908-41db-9c37-26c89f7f2456) ![jolsen](https://github.com/microsoft/terminal/assets/15957528/68553507-d29e-4513-89ce-b1cd305d28b7) ![image](https://github.com/microsoft/terminal/assets/15957528/18864f60-91d0-4159-87da-2b2ee1637a4c) ## `_runtimeFocusedOpacity` Mike also had to say something about this: #2531 (comment) Initially I had something like ` _setOpacity(newAppearance->Opacity());` But with the introduction of unfocused opacity we encounter new challenges: When Adjusting the Opacity with **CTRL+SHIFT+Mouse Scroll Wheel** or **Set background opacity** in command pallette, the Runtime opacity changes, but when we go to unfocused and back to focused the opacity changes back to focused opacity in Settings. Also when adjusting opacity through the command palette the window becomes unfocused and then focused again after setting background opacity hence the ` _setOpacity(newAppearance->Opacity());` would override the changes made through command palette ![runtimeFocusedOpacity](https://github.com/microsoft/terminal/assets/15957528/4de63057-d658-4b5e-99ad-7db050834ade) ![command_pallette_focusswitches](https://github.com/microsoft/terminal/assets/15957528/372526eb-cf0c-40f8-a4e5-a0739f1f0e05) With the introduction of unfocused opacity we encounter new challenges. The runtime opacity stores both the unfocused opacity and focused opacity from settings at different moments. This all works well until we combine this with Adjusting the Opacity with **CTRL+SHIFT+Mouse Scroll Wheel** or **Set background opacity** in command pallette. This brings the need for a separate Focused Opacity. When we change the runtime opacity with scroll wheel or through command pallette this value needs to be stored separately from the one in settings. So we can change back to it when going to unfocused mode and back to focused instead of the focused opacity defined in settings. ## `skipUnfocusedOpacity` solves Opacity going from solid to unfocused to focused bug: ![skipUnfocusedOpacity_bug](https://github.com/microsoft/terminal/assets/15957528/ecc06dcf-fbef-4fef-a40f-68278fdbfb12) ## Validation Steps Performed - Checked if unfocused Opacity works well when adjusting opacity through Mouse Scroll Wheel or Command Palette and in combination with Acrylic as mentioned in "Detailed Description of the Pull Request / Additional comments" ## PR Checklist - [x] Closes #11092 - [ ] Tests added/passed - [x] Documentation updated - If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here:(MicrosoftDocs/terminal#714) - [ ] Schema updated (if necessary) (cherry picked from commit 27e1081) Service-Card-Id: 90949918 Service-Version: 1.19
Added Enable Unfocused Acrylic Global Setting Updated Opacity and Acrylic. No more OS limitations! microsoft/terminal#15974 --------- Co-authored-by: Matt Wojciakowski <mattwoj@microsoft.com>
Summary of the Pull Request
Closes #11092
Allowing
opacity
to be set differently in both focused and unfocused terminalsReferences and Relevant Issues
#11092 , references: #7158
Detailed Description of the Pull Request / Additional comments
Allowing Opacity to be set differently in both focused and unfocused terminals:
_runtimeFocusedOpacity
Mike also had to say something about this: #2531 (comment)
Initially I had something like
_setOpacity(newAppearance->Opacity());
But with the introduction of unfocused opacity we encounter new challenges:
When Adjusting the Opacity with CTRL+SHIFT+Mouse Scroll Wheel or Set background opacity in command pallette, the Runtime opacity changes, but when we go to unfocused and back to focused the opacity changes back to focused opacity in Settings.
Also when adjusting opacity through the command palette the window becomes unfocused and then focused again after setting background opacity hence the
_setOpacity(newAppearance->Opacity());
would override the changes made through command paletteWith the introduction of unfocused opacity we encounter new challenges. The runtime opacity stores both the unfocused opacity and focused opacity from settings at different moments. This all works well until we combine this with Adjusting the Opacity with CTRL+SHIFT+Mouse Scroll Wheel or Set background opacity in command pallette. This brings the need for a separate Focused Opacity. When we change the runtime opacity with scroll wheel or through command pallette this value needs to be stored separately from the one in settings. So we can change back to it when going to unfocused mode and back to focused instead of the focused opacity defined in settings.
skipUnfocusedOpacity
solves Opacity going from solid to unfocused to focused bug:Validation Steps Performed
PR Checklist