-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 progress ring indicator to the tab header #8133
Conversation
…/pabhoj/taskbar_progress
…state and progress params
Maybe we should extract some common pattern in this PR to support features like #8106 in the future. |
@@ -85,6 +85,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation | |||
GETSET_SETTING(bool, AlwaysOnTop, false); | |||
GETSET_SETTING(Model::TabSwitcherMode, TabSwitcherMode, Model::TabSwitcherMode::InOrder); | |||
GETSET_SETTING(bool, DisableAnimations, false); | |||
GETSET_SETTING(bool, DisableProgressRing, false); |
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.
quick check on: why is this a setting? is it too specific? should we have an enum for progressIndicatorStyle? tab|taskbar|all|none
? I don't know!
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.
That's... a fair point. Given that browsers/Visual Studio/other things that have progress indicators do not offer a way to disable them (as far as I know), I'm thinking we remove the setting.
Thoughts?
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.
Notes inline
|
Hello @DHowett! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
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.
Confession: I never really get it why this means "shipit".
excellent question! |
@zadjii-msft Thanks! Such a straightforward answer, which takes only ~4000 words if you include the background story. Originally when I saw in some of PRs in the repo, I imagine the meaning of it is "huh you know what, the PR is good, but not that good, so I need to take a look, but from a distance, in a sneaky way, like a squirrel/mouse, for some reason". Yeah, my mind is weird, I know. |
This commit adds a [progress ring] to the tab header when we receive an OSC 9 sequence. Adds an event handler in `Tab.cpp` for the event we raise when we get a request to set the taskbar state/progress. This event handler updates the tab header with the active control's state/progress. When we want to show the progress ring, we hide the tab icon and place the progress ring over it. [progress ring]: https://docs.microsoft.com/en-us/uwp/api/Microsoft.UI.Xaml.Controls.ProgressRing?view=winui-2.4 References microsoft#6700
It turns out that the negative margin for the progress ring is causing the clipping in case the tab title gets too long: https://github.com/microsoft/terminal/blob/43dbbd590fa4b46c37e9970415f8150d3c399598/src/cascadia/TerminalApp/TabHeaderControl.xaml#L18-L27 The negative margin was introduced in #8113 because the progress ring is supposed to replace the tab icon but the `TabView` still reserves space even if no icon is set (see #8133 (comment)). However, it is not actually the `TabView` reserving space even when there is no icon, but a workaround for a crash in the `IconPathConverter` that returns a `BitmapIconSource` with a `nullptr` source instead of a `nullptr` `IconSource`: https://github.com/microsoft/terminal/blob/43dbbd590fa4b46c37e9970415f8150d3c399598/src/cascadia/TerminalSettingsModel/IconPathConverter.cpp#L143-L154 The workaround in `IconPathConverter` could probably be removed as I did not find any instance where it is still used in a way that could trigger the mentioned crash, but I did not dare to just remove it as I do not know enough about the code by far. Hence, I opted to just locally instantiate the `IconSource` with a `nullptr` directly in `TerminalTab`. Fixes #8910
It turns out that the negative margin for the progress ring is causing the clipping in case the tab title gets too long: https://github.com/microsoft/terminal/blob/43dbbd590fa4b46c37e9970415f8150d3c399598/src/cascadia/TerminalApp/TabHeaderControl.xaml#L18-L27 The negative margin was introduced in #8113 because the progress ring is supposed to replace the tab icon but the `TabView` still reserves space even if no icon is set (see #8133 (comment)). However, it is not actually the `TabView` reserving space even when there is no icon, but a workaround for a crash in the `IconPathConverter` that returns a `BitmapIconSource` with a `nullptr` source instead of a `nullptr` `IconSource`: https://github.com/microsoft/terminal/blob/43dbbd590fa4b46c37e9970415f8150d3c399598/src/cascadia/TerminalSettingsModel/IconPathConverter.cpp#L143-L154 The workaround in `IconPathConverter` could probably be removed as I did not find any instance where it is still used in a way that could trigger the mentioned crash, but I did not dare to just remove it as I do not know enough about the code by far. Hence, I opted to just locally instantiate the `IconSource` with a `nullptr` directly in `TerminalTab`. Fixes #8910 (cherry picked from commit 21a9c55) Service-Card-Id: 86209056 Service-Version: 1.16
This commit adds a progress ring to the tab header when we receive an
OSC 9 sequence.
Adds an event handler in
Tab.cpp
for the event we raise when we get arequest to set the taskbar state/progress. This event handler updates
the tab header with the active control's state/progress.
When we want to show the progress ring, we hide the tab icon and place
the progress ring over it.
References #6700