Auto-show progress in task bar based on contents of last line of buffer #11640

Open
opened 2026-01-31 02:53:22 +00:00 by claunia · 7 comments
Owner

Originally created by @kishanth-ithayakumar on GitHub (Dec 1, 2020).

Description of the new feature/enhancement

Display percentage loading indicator in windows taskbar.
image

  1. Read the last output line in the console.
  2. If there's a string, such as "12%" or "12/100" then, display the percentage in task bar.

Proposed technical implementation details (optional)

Originally created by @kishanth-ithayakumar on GitHub (Dec 1, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement Display percentage loading indicator in windows taskbar. ![image](https://user-images.githubusercontent.com/60095311/100732212-b94b5900-33cc-11eb-8d6b-a7875c58b5f3.png) 1. Read the last output line in the console. 2. If there's a string, such as "12%" or "12/100" then, display the percentage in task bar. <!-- A clear and concise description of what the problem is that the new feature would solve. Describe why and how a user would use this new functionality (if applicable). --> # Proposed technical implementation details (optional) <!-- A clear and concise description of what you want to happen. -->
claunia added the Issue-TaskProduct-TerminalArea-TerminalControl labels 2026-01-31 02:53:23 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Dec 1, 2020):

IIRC, this is something that ConEmu does, so we could add a setting to enable this too. I'll link it up with the others at #6700, thanks!

@zadjii-msft commented on GitHub (Dec 1, 2020): IIRC, this is something that ConEmu does, so we could add a setting to enable this too. I'll link it up with the others at #6700, thanks!
Author
Owner

@skyline75489 commented on GitHub (Dec 16, 2020):

Some thoughts: if every single line needs to be read to determine whether it's an progress indicator line like 42% (42/100), would it cause measurably impact on performance? I highly suspect that it would, no matter how fast regex is. Just imagine how much output bcz produces. We definitely do not want to throw all the CPU away after all the hard work trying to save as many as CPU cycles as possible.

So here's my two cents. The progress indicator line ususally just sticks right at the bottom, right? We should detect this scenerio instead of filtering every single line that's feed to us.

@skyline75489 commented on GitHub (Dec 16, 2020): Some thoughts: if every single line needs to be read to determine whether it's an progress indicator line like `42% (42/100)`, would it cause measurably impact on performance? I highly suspect that it would, no matter how fast regex is. Just imagine how much output `bcz` produces. We definitely do not want to throw all the CPU away after all the hard work trying to save as many as CPU cycles as possible. So here's my two cents. The progress indicator line ususally just sticks right at the bottom, right? We should detect this scenerio instead of filtering every single line that's feed to us.
Author
Owner

@zadjii-msft commented on GitHub (Dec 16, 2020):

I believe that's how ConEmu and mintty implemented this as well - it's only detection on the very last line.

@zadjii-msft commented on GitHub (Dec 16, 2020): I believe that's how ConEmu and mintty implemented this as well - it's only detection on the very last line.
Author
Owner

@DHowett commented on GitHub (Dec 17, 2020):

Backlog approved!

@DHowett commented on GitHub (Dec 17, 2020): Backlog approved!
Author
Owner

@dannyvv commented on GitHub (Jan 14, 2021):

@DHowett When considering, please also consider supporting the existing api's for windows' taskbar:

There is also some existing art for AzureDevops where special markers in the text stream can show percentage completed of a task.

It would be great if these could be unified. (maybe get agreement on some metadata markers for this) I.e. if the shell could standardize on a pattern that then other systems like github actions, azure devops could consume as is.

image
It would be great if these would work in the tabs (and perhaps translate the 'latest' or 'in focus' tab to the windows taskbar.

@dannyvv commented on GitHub (Jan 14, 2021): @DHowett When considering, please also consider supporting the existing api's for windows' taskbar: * [progressvalue](https://docs.microsoft.com/en-us/dotnet/api/system.windows.shell.taskbariteminfo.progressvalue?view=net-5.0) * [progressstate](https://docs.microsoft.com/en-us/dotnet/api/system.windows.shell.taskbariteminfo.progressstate?view=net-5.0) It worked fine with the old cmd has api's for reporting progress, warning and error states... The [BuildXL](https://github.com/microsoft/buildxl) build engine uses this with this [TaskBarInterop.cs](https://github.com/microsoft/BuildXL/blob/master/Public/Src/Utilities/Utilities/Tracing/TaskBarInterop.cs) code. There is also some existing art for AzureDevops where special markers in the text stream can [show percentage completed](https://docs.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?view=azure-devops&tabs=bash#setprogress-show-percentage-completed) of a task. It would be great if these could be unified. (maybe get agreement on some metadata markers for this) I.e. if the shell could standardize on a pattern that then other systems like github actions, azure devops could consume as is. ![image](https://user-images.githubusercontent.com/11037542/104654445-f4e66d80-5670-11eb-96ae-6d40057359af.png) It would be great if these would work in the tabs (and perhaps translate the 'latest' or 'in focus' tab to the windows taskbar.
Author
Owner

@KalleOlaviNiemitalo commented on GitHub (Jan 15, 2021):

@dannyvv, letting ITaskbarList3::SetProgressState set progress on the window returned by GetConsoleWindow and making Windows Terminal proxy that to its own window looks difficult to me:

  • ITaskbarList3 has no GetProgressState method with which Windows Terminal could read the changes made by the application.
  • Even if there were such a method, I don't think there is a notification about progress changes, so Windows Terminal would have to poll.

Perhaps Windows Terminal could instead use ITaskbarList3::RegisterTab to show all panes (not just tabs) in the task bar, and let the task bar combine the progress info… but I guess this would require the registered windows to be visible.

Anyway, it seems the implementation would be complex and almost separate from what was previously requested in this issue.

Making BuildXL output the OSC 9;4 sequence might be much easier.

@KalleOlaviNiemitalo commented on GitHub (Jan 15, 2021): @dannyvv, letting ITaskbarList3::SetProgressState set progress on the window returned by GetConsoleWindow and making Windows Terminal proxy that to its own window looks difficult to me: * ITaskbarList3 has no GetProgressState method with which Windows Terminal could read the changes made by the application. * Even if there were such a method, I don't think there is a notification about progress changes, so Windows Terminal would have to poll. Perhaps Windows Terminal could instead use ITaskbarList3::RegisterTab to show all panes (not just tabs) in the task bar, and let the task bar combine the progress info… but I guess this would require the registered windows to be visible. Anyway, it seems the implementation would be complex and almost separate from what was previously requested in this issue. Making BuildXL output the OSC 9;4 sequence might be much easier.
Author
Owner

@DHowett commented on GitHub (Jan 20, 2021):

Indeed. We talked about this way back when we were first doing ConPTY stuff, and it's capital-H hard. It only works in BXL (and razzle!) because we made the mistake of allowing applications DIRECT unfettered access to the console window handle, which we just can't do any longer. Switching to OSC 9;4 makes it compatible with more terminal emulators on Windows, and even has the benefit of working over a remote connection (say you're remoting to a build machine to fix a build break.)

@DHowett commented on GitHub (Jan 20, 2021): Indeed. We talked about this way back when we were first doing ConPTY stuff, and it's capital-H _hard_. It only works in BXL (and razzle!) because we made the mistake of allowing applications DIRECT unfettered access to the console window handle, which we just can't do any longer. Switching to OSC 9;4 makes it compatible with more terminal emulators on Windows, and even has the benefit of working over a remote connection (say you're remoting to a build machine to fix a build break.)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11640