Skip to content

Commit

Permalink
Make ctrl+shift+scroll toggle acrylic on/off at extrema (microsoft#4853)
Browse files Browse the repository at this point in the history
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 microsoft#661
  • Loading branch information
abhijeetviswam committed Mar 12, 2020
1 parent 4746ba5 commit ec518a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doc/user-docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
15 changes: 15 additions & 0 deletions src/cascadia/TerminalControl/TermControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ec518a1

Please sign in to comment.