Make ctrl+shift+scroll toggle acrylic on/off at extrema (#4853)

If UseAcrylic is disabled, CTRL+SHIFT+SCROLL would enable it, without
having to change the setting in profile.json manually.

1. Set "useAcrylic" to false for the any profile in profile.json
2. Open terminal window for that profile.
3. CTRL+SHIFT+MouseScroll
   Acrylic background opacity should change according to mouse scroll

## PR Checklist
* [x] CLA signed.
* [x] Tested manually
* [x] Updated documentation

Closes #661
This commit is contained in:
Abhijeet Viswam 2020-03-11 23:18:58 +05:30 committed by GitHub
parent a80382b1c4
commit e596943ed2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View file

@ -85,6 +85,6 @@ For an introduction to the various settings, see [Using Json Settings](UsingJson
(ref [https://twitter.com/r_keith_hill/status/1142871145852440576](https://twitter.com/r_keith_hill/status/1142871145852440576))
2. Terminal zoom can be changed by holding <kbd>Ctrl</kbd> and scrolling with mouse.
3. If `useAcrylic` is enabled in profiles.json, background opacity can be changed by holding <kbd>Ctrl</kbd>+<kbd>Shift</kbd> and scrolling with mouse. Note that acrylic transparency is limited by the OS only to focused windows.
3. Background opacity can be changed by holding <kbd>Ctrl</kbd>+<kbd>Shift</kbd> and scrolling with mouse. Note that acrylic transparency is limited by the OS only to focused windows.
4. Open Windows Terminal in current directory by typing `wt -d .` in the address bar.
5. Please add more Tips and Tricks.

View file

@ -1095,9 +1095,24 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
{
auto acrylicBrush = RootGrid().Background().as<Media::AcrylicBrush>();
acrylicBrush.TintOpacity(acrylicBrush.TintOpacity() + effectiveDelta);
if (acrylicBrush.TintOpacity() == 1.0)
{
_settings.UseAcrylic(false);
_InitializeBackgroundBrush();
uint32_t bg = _settings.DefaultBackground();
_BackgroundColorChanged(bg);
}
}
CATCH_LOG();
}
else if (mouseDelta < 0)
{
_settings.UseAcrylic(true);
//Setting initial opacity set to 1 to ensure smooth transition to acrylic during mouse scroll
_settings.TintOpacity(1.0);
_InitializeBackgroundBrush();
}
}
// Method Description: