-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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 a key binding Toggle Acrylic #15717
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
e2f9c15
to
717f86d
Compare
@zadjii-msft @DHowett Solved the issues. It's ready to be reviewed. Let me know if any changes need to be made. |
@zadjii-msft @DHowett-MSFT @DHowett Hi Dustin, Hi Mike, I was wondering if you got a chance yet to review the code? @zadjii-msft |
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 I suppose I'm mostly just curious about the runtime setting thing. That seems like it would get us a lot of this for free.
Sorry for the delays! Been a busy summer 😅
src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw
Outdated
Show resolved
Hide resolved
// Don't Toggle Acrylic if they have transparency turned off | ||
if (Opacity() < 1.0) | ||
{ | ||
UseAcrylic(!_acrylicToggle); |
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.
So this line will set the _runtimeUseAcrylic
value to !_acrylicToggle
. Presumably, the first time, this always sets it to true
(since _acrylicToggle
will always be initialized to false).
What happens if the user has acrylic enabled in their settings originally? I don't believe this would toggle it off the first time.
Ignore me, I saw the _acrylicToggle = _settings->UseAcrylic();
line in ControlCore::UpdateSettings
just now
@@ -272,6 +274,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation | |||
std::shared_ptr<ThrottledFuncTrailing<Control::ScrollPositionChangedArgs>> updateScrollBar; | |||
}; | |||
|
|||
bool _acrylicToggle; |
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.
Why add another bool here, rather than leverage the existing UseAcrylic
RUNTIME_SETTING
?
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 Initially I used the UseAcrylic RUNTIME_SETTING
and it seemed to work, but after testing Mouse Scroll Wheel to change Opacity and Adjust Opacity to change opacity, I stumbled upon some problems with this method.
The actual Terminal Preview behaviour with UseAcrylic TRUE in settings.json in these scenarios:
When the user uses Mouse Scroll Wheel to change Opacity and Adjust Opacity to change opacity through the command palette the ControlCore::_setOpacity
function is triggered. This function manually turns off the _runtimeUseAcrylic
when opacity becomes 100.
When the user scroll to opacity 100 and then scroll down again, the runtime acrylic goes false at 100 and would stay false when you go back under 100. Also when adjusting the opacity through the command palette similar thing happens when going to set background opacity to 100% option it stays false when going to 25%, 50%, etc.
Basically we can’t use the UseAcrylic RUNTIME_SETTING
, because it becomes False when the user turns off transparency(opacity becomes 100) by using Mouse Scroll Wheel to change Opacity and Adjust Opacity to change opacity and we can’t use UseAcrylic RUNTIME_SETTING
to turn _runtimeUseAcrylic
back on since it’s false. So I figured we need to use an external boolean besides the UseAcrylic () RUNTIME_SETTING
.
Using an external boolean solves these issues.
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 How would you have solved this problem?
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.
Hmm, so I tried something in ffc7862.
Instead of setting _runtimeUseAcrylic
based on the opacity, when the opacity changes, just do the opacity < 1.0
when we actually need it.
That seems to work... I'll play with it more but that's a start
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.
took 🗡️
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 Are you a DnD player?
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.
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.
I see, I didn't play much Zelda to be honest ..
@zadjii-msft So I would like to know if you still get notifications when something is said inside 2531 once it's merged. |
I get emails for every comment and on every issue, PR and discussion, and I try best to keep on top of them, no worries |
Accepted Mike's suggestion comment for translators + value more consistent with codebase Co-authored-by: Mike Griese <migrie@microsoft.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…opacity changes, just do the opacity < 1.0 when we actually need it.
Summary of the Pull Request
Added a key binding Toggle Acrylic
References and Relevant Issues
#2531
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
Tested whether things are still working along with:
In both situations with
PR Checklist