Skip to content
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

[Scenario] Progress Bar Follow-ups #6700

Open
3 of 8 tasks
zadjii-msft opened this issue Jun 27, 2020 · 21 comments
Open
3 of 8 tasks

[Scenario] Progress Bar Follow-ups #6700

zadjii-msft opened this issue Jun 27, 2020 · 21 comments
Assignees
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Area-VT Virtual Terminal sequence support Issue-Scenario Product-Terminal The new Windows Terminal.
Milestone

Comments

@zadjii-msft
Copy link
Member

zadjii-msft commented Jun 27, 2020

[Original issue: #3004] [Initial PR: #8055] [Display the progress in the tab: #8133]

This is a list of tasks, bugs, etc, related to the "taskbar progress indicator", as first implemented in #8055. While not all of them are immediately relevant for the taskbar indicator, they're all related to the showing of progress state in the Terminal.

Sequence Description

ESC ] 9 ; 4 ; st ; pr ST

Set progress state on Windows taskbar and tab. When `st` is:
  • 0: remove progress.
  • 1: set progress value to pr (number, 0-100).
  • 2: set the taskbar to the "Error" state
  • 3: set the taskbar to the "Indeterminate" state
  • 4: set the taskbar to the "Warning" state

Follow-up work

  1. Area-User Interface Help Wanted Issue-Feature Product-Terminal
  2. Area-User Interface Issue-Feature Product-Terminal
  3. Area-TerminalControl Issue-Task Product-Terminal
  4. Area-User Interface Help Wanted Issue-Task Product-Terminal
  5. Area-User Interface Issue-Bug Priority-3 Product-Terminal Resolution-Fix-Committed
  6. Area-User Interface Issue-Bug Priority-2 Product-Terminal Resolution-Fix-Committed
    zadjii-msft
  7. Area-User Interface Issue-Bug Priority-2 Product-Terminal Resolution-Fix-Committed
  8. Area-User Interface Help Wanted Issue-Task Product-Terminal

"Auto-detect output, display in tab/taskbar" (#7955) and #1620 are very closely related

Bell notifications

These cover some of the same areas of the above, so I'm including them because I feel they deserve a mention here:

Related?

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jun 27, 2020
@ghost ghost closed this as completed Jun 27, 2020
@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jun 27, 2020
@ghost

This comment has been minimized.

@zadjii-msft zadjii-msft reopened this Jun 27, 2020
@ghost ghost added the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Jul 1, 2020
@microsoft microsoft deleted a comment Jul 1, 2020
@ghost ghost removed the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Jul 1, 2020
@zadjii-msft zadjii-msft removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 1, 2020
@DHowett DHowett removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jul 2, 2020
@miniksa miniksa added ⛺ Reserved For future use and removed Needs-Tag-Fix Doesn't match tag requirements labels Jul 6, 2020
@zadjii-msft zadjii-msft changed the title Reserved for future use [Scenario] Progress Bar Follow-ups Oct 29, 2020
@zadjii-msft zadjii-msft added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Area-VT Virtual Terminal sequence support Issue-Scenario Product-Terminal The new Windows Terminal. and removed ⛺ Reserved For future use labels Oct 29, 2020
@zadjii-msft zadjii-msft added this to the Terminal v2.0 milestone Oct 29, 2020
@PankajBhojwani PankajBhojwani self-assigned this Nov 16, 2020
@qu1ck
Copy link

qu1ck commented Nov 30, 2020

Just some context on how conemu does autodetection of long running operations: if last line starts with [int]% it assumes that it's a progress indicator and sets tab name accordingly and also taskbar state:

image

I would love to see something like this in terminal.

ghost pushed a commit that referenced this issue Dec 16, 2020
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 #6700
@sba923
Copy link

sba923 commented Jan 29, 2021

"warning": ^[]9;4;4;100^G
image

"error": ^[]9;4;2;100^G
image

One is yellow, the other is red...

Oh... reading #8055 and experimenting, I had not guessed / understood that the pr argument must be present, even when useless. It doesn't seem needed for 0 and 3, but now I know that a dummy non-zero argument must be there for 2 and 4...

@tringi
Copy link

tringi commented Feb 1, 2021

It doesn't seem like a bad idea to combine these states somehow (with a setting), but we'd want to make sure we're clear what happens in cases like:

  • one tab has progress=N%, another tab has no progress
  • one tab has progress=N%, another tab has progress=M%
  • one tab has progress=N%, another tab has progress=indeterminate
  • one tab has progress=N%, another tab has progress=M% AND is in the error state

etc.

Sure, we have to specify this exhaustively.

It is specified in Taskbar API here how progress bars are combined for multiple windows collapsed into single button. For consistency it would be good idea to duplicate the behavior.

@zadjii-msft
Copy link
Member Author

It is specified in Taskbar API here how progress bars are combined for multiple windows collapsed into single button. For consistency it would be good idea to duplicate the behavior.

image

Thanks for that. We should do that.

@WSLUser
Copy link
Contributor

WSLUser commented Feb 3, 2021

FYI, this WinUI bug still exists: microsoft/microsoft-ui-xaml#3787

@sba923
Copy link

sba923 commented Feb 8, 2021

On at least two of my systems ESC ] 9 ; 4 ; 3 ; 100 BEL does cause the rotating symbol on the Windows Terminal tab, but doesn't trigger the animation on the taskbar button. Shall I open a separate issue for that?

@sba923
Copy link

sba923 commented Mar 4, 2021

On at least two of my systems ESC ] 9 ; 4 ; 3 ; 100 BEL does cause the rotating symbol on the Windows Terminal tab, but doesn't trigger the animation on the taskbar button. Shall I open a separate issue for that?

Opened #9374

@tringi
Copy link

tringi commented Mar 5, 2021

A little off topic, but wouldn't it be trivial to add this also to Conhost? Just simply forward the command to ITaskbarList3?

Thinking about it... now that this is open, I might even try myself.

@sba923
Copy link

sba923 commented Mar 16, 2021

On at least two of my systems ESC ] 9 ; 4 ; 3 ; 100 BEL does cause the rotating symbol on the Windows Terminal tab, but doesn't trigger the animation on the taskbar button. Shall I open a separate issue for that?

Opened #9374

#9374 closed with solution by @DHowett: one must enable animations under Settings / Ease of Access / Display:

image

Without this, only OSC9;4;x;yST with x=1,2,4 are fully functional.

ghost pushed a commit that referenced this issue May 24, 2021
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? -->
## Summary of the Pull Request
Adds a new bellStyle called `window`. When `window` is set and a BEL is emitted, we flash the pane that emitted it. 

Additionally, changes bellStyle in the SUI to a list of checkboxes instead of radio buttons, to match bellStyle being a flag-enum. Deprecates 'BellStyle::Visual' in the schema, but still allows it to be set in the json (it maps to `Window | Taskbar`)

<!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> 
## References
#6700 

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
* [ ] Closes #xxx
* [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA
* [ ] Tests added/passed
* [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx
* [ ] Schema updated.
* [x] I work here

<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
GIF in Teams
ghost pushed a commit that referenced this issue Aug 10, 2021
## Summary of the Pull Request
![background-progress-000](https://user-images.githubusercontent.com/18356694/126653006-3ad2fdae-67ae-4cdb-aa46-25d09217e365.gif)

This PR causes the Terminal to combine taskbar states at the tab and window level, according to the [MSDN docs for `SetProgressState`](https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setprogressstate#how-the-taskbar-button-chooses-the-progress-indicator-for-a-group). 

This allows the Terminal's taskbar icon to continue showing progress information, even if you're in a pane/tab that _doesn't_ have progress state. This is helpful for cases where the user may be running a build in one tab, and working on something else in another.

## References

* [`SetProgressState`](https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setprogressstate#how-the-taskbar-button-chooses-the-progress-indicator-for-a-group)
* Progress mega: #6700 

## PR Checklist
* [x] Closes #10090
* [x] I work here
* [ ] Tests added/passed
* [n/a] Requires documentation to be updated

## Detailed Description of the Pull Request / Additional comments

This also fixes a related bug where transitioning from the "error" or "warning" state directly to the "indeterminate" state would cause the taskbar icon to get stuck in a bad state.

## Validation Steps Performed

<details>
<summary><code>progress.cmd</code></summary>

```cmd
@echo off
setlocal enabledelayedexpansion

set _type=3
if (%1) == () (
    set _type=3
) else (
    set _type=%1
)



if (%_type%) == (0) (
    <NUL set /p =�]9;4�
    echo Cleared progress
)
if (%_type%) == (1) (
    <NUL set /p =�]9;4;1;25�
    echo Started progress (normal, 25^)
)
if (%_type%) == (2) (
    <NUL set /p =�]9;4;2;50�
    echo Started progress (error, 50^)
)
if (%_type%) == (3) (
    @Rem start indeterminate progress in the taskbar
    @Rem this `<NUL set /p =` magic will output the text _without a newline_

    <NUL set /p =�]9;4;3�
    echo Started progress (indeterminate, {omitted})
)
if (%_type%) == (4) (
    <NUL set /p =�]9;4;4;75�
    echo Started progress (warning, 75^)
)

```

</details>
@zadjii-msft zadjii-msft modified the milestones: Terminal v2.0, Megathreads Jan 4, 2022
@sba923
Copy link

sba923 commented Sep 7, 2022

On at least two of my systems ESC ] 9 ; 4 ; 3 ; 100 BEL does cause the rotating symbol on the Windows Terminal tab, but doesn't trigger the animation on the taskbar button. Shall I open a separate issue for that?

Opened #9374

#9374 closed with solution by @DHowett: one must enable animations under Settings / Ease of Access / Display:

Here's the state of affairs on this issue:

  1. on one system, even with "Show Animations in Windows" set to "on", the animation's still missing
  2. on the same system, the "Show Animations in Windows" setting keeps turning itself off

This has been discussed in #9374 up to the point where I created https://aka.ms/AAehwy4, and from there no progress has been made.

@aetonsi
Copy link

aetonsi commented Mar 9, 2023

Hi, is there, anywhere, a clear documentation about all of these behaviors? If not, would it be possible to add a brief section in the Console Virtual Terminal Sequences page (if that's the correct location)?

I'm asking because i have a couple of quick questions but i can't find the answer anywhere, the information is pretty fragmented (it seems to me). I'm going to place them here in case anyone has an answer.

First question
It's possible to switch from "progress" (green taskbar) status to "error"/"warning" status (red/yellow) without altering and without even knowing the current progress percentage. This is possible by using st=2/4 (error/warning) combined with pr= (empty string).
For example, if the status bar is currently 33% in "progress" (green) status, using st=2 and pr= i can go to 33% "error" (red) status.
The question is: is it possible to do the same but in the opposite direction? meaning, for example, is it possible to go from 33% "error" status to the same percentage but in "progress" status?
I tried st=1 and pr= /-1/0 either do nothing or simply reset the taskbar (as if st was 0)

Second question
In #8055 it is said:

We've also extended this with:

  • st 3: set indeterminate state
  • st 4: set paused state

What it is meant with "paused state"? is it referring to conemu's "warning" state? or is it some additional/custom WindowsTerminal's feature?


thank you everyone

@j4james
Copy link
Collaborator

j4james commented Mar 9, 2023

The question is: is it possible to do the same but in the opposite direction? meaning, for example, is it possible to go from 33% "error" status to the same percentage but in "progress" status?

No. The default percent value for an error state is the whatever current percent is (that's why you can change from st=1 to st=2 without setting the percent), but the default percent value for the progress state is 0. In other words, if you set st=1 with no percent, you're getting 0%, which is the same as disabling the progress.

What it is meant with "paused state"? is it referring to conemu's "warning" state?

Yes. At the time this feature was being developed, ConEmu had only documented states 0, 1, and 2. I think state 3 may already have been implemented, but not yet documented. State 4 was then proposed by Windows Terminal, but it was discussed with the Maximus5 first, who agreed to add matching functionality to ConEmu. The ConEmu documentation now includes all 5 states (see ConEmu specific OSC).

@aetonsi
Copy link

aetonsi commented Mar 10, 2023

No. The default percent value for an error state is the whatever current percent is (that's why you can change from st=1 to st=2 without setting the percent), but the default percent value for the progress state is 0. In other words, if you set st=1 with no percent, you're getting 0%, which is the same as disabling the progress.

Is this a Windows default?

Is there a system API to read the current progress percentage? Because if there is, it would nice if WindowsTerminal's behaviour was more consistent, maintaining the current percentage whenever pr= , even when going from st=2/4 to st=1 (by first reading the current "error"/"warning" percentage, then applying the "progress" state with that percentage).

If you deem this to be too misleading, because it wouldn't match the OS' behaviour, i'd just like to know if a WT escape code/API/something to get the current percentage exists, so that i can use it in my utilities to achieve the aforementioned behaviour. Something like the ESC[6n escape code which "returns" the cursor position in the stdin stream (even though i don't know how to read the returned value...)

@j4james
Copy link
Collaborator

j4james commented Mar 10, 2023

Is this a Windows default?

No. That's the way it was defined by ConEmu. We're just following their specification.

i'd just like to know if a WT escape code/API/something to get the current percentage exists

No. The simplest option would be for you to keep track of the last percentage value yourself, since I'm assuming you're the one that set it. But if that's not an option for you, then I don't have any other ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Area-VT Virtual Terminal sequence support Issue-Scenario Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

10 participants