Implement ConEmu's OSC 9;4 to set the taskbar progress indicator#8055
Implement ConEmu's OSC 9;4 to set the taskbar progress indicator#8055
Conversation
|
zadjii-msft
left a comment
There was a problem hiding this comment.
I'm blocking mostly over the 3 thing, but there's still a bunch to do on this PR so I guess this block is mostly for show
bc11ad9 to
606490f
Compare
| #include <cstring> | ||
| #include <shellscalingapi.h> | ||
| #include <windowsx.h> | ||
| #include <ShObjIdl.h> |
There was a problem hiding this comment.
Do we really want to add this to pch.h? Personally I try to avoid adding things into PCH because the damage it does to compiling speed.
There was a problem hiding this comment.
meh, this one's not so bad. We'll probably end up using it in other places across the project, and I'd rather eat the compile time once in the pch phase rather than many times across rebuilds.
It's the winrt headers that really chew up pch time 😑
zadjii-msft
left a comment
There was a problem hiding this comment.
Wow these are such nits for something that works so well and I'm so excited about
| #include <cstring> | ||
| #include <shellscalingapi.h> | ||
| #include <windowsx.h> | ||
| #include <ShObjIdl.h> |
There was a problem hiding this comment.
meh, this one's not so bad. We'll probably end up using it in other places across the project, and I'd rather eat the compile time once in the pch phase rather than many times across rebuilds.
It's the winrt headers that really chew up pch time 😑
zadjii-msft
left a comment
There was a problem hiding this comment.
I REALLY want to sign off on this. I think it's ready to go, save for two things:
- make sure the
pfnisn't nullptr inTerminalApi.cpp - Maybe add tests to
UnitTests_TerminalCore? We've got tests inScreenBufferTests.cppthat write VT sequences to the buffer and make sure that the state of theSCREEN_INFORMATIONin conhost is updated as we'd expect, maybe we should add something similar here?
…state and progress params
## Summary of the Pull Request Does what the title says. Now while you're building terminal projects, the taskbar will show indeterminate progress. If the build fails, it'll blink the error state for 500ms before returning to normal. ## References * Made possible by #8055 _and viewers like you_ ## PR Checklist * [x] scratches an itch I've had since at least 2018 * [x] I work here * [x] this is a build script ## Validation Steps Performed tested manually
…8335) ## Summary of the Pull Request Does what the title says. Now while you're building terminal projects, the taskbar will show indeterminate progress. If the build fails, it'll blink the error state for 500ms before returning to normal. ## References * Made possible by microsoft#8055 _and viewers like you_ ## PR Checklist * [x] scratches an itch I've had since at least 2018 * [x] I work here * [x] this is a build script ## Validation Steps Performed tested manually
|
I must be missing something. I'm running Windows Terminal 1.4.3243.0, and this (PowerShell 7.1.1, FWIW) doesn't do anything: RTFM answers kindly accepted 😋 |
|
@sba923, this feature is on the release-1.6 branch, but not on the release-1.4 and release-1.5 branches. |
Phew. I haven't gone mad after all. I just need to be patient 😉 or build myself a 1.6 binary. |
I don't have to wait anymore thanks to v1.6.10272.0 Preview |
The terminal will show a "Indeterminate" state progress while the server is starting See microsoft/terminal#8055 for more info
### What does this PR try to resolve? A few terminal emulators support progress output to Windows taskbar. `winget` uses this to show install progress. Notably, Windows Terminal [recently (2020) added support](microsoft/terminal#8055) for ANSI codes [specified](https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC) in ConEmu (another terminal emulator for Windows) documentation. Also, in "[Learn Windows](https://learn.microsoft.com/en-us/windows/terminal/tutorials/progress-bar-sequences)". I've found the previous attempt to add this feature: #11436 As per @weihanglo's request, I've added the config option to enable/disable this feature. **It's enabled on supported terminal emulators.** Fixes #11432 FCP: #14615 (comment) ### How should we test and review this PR? Run `cargo build` in Windows Terminal with configuration option `term.progress.taskbar` set to `true`. ### Not sure - [x] Should all the code be `#[cfg(windows)]`? Probably no, because the feature is also usable in WSL. > Solved by introducing heuristic based on environment variable set by terminal - [ ] If Ctrl+C is pressed, a progressbar will stay in a last state forever (shown in the ConEmu video). `winget` is also behaves like alike. I've experimented with `ctrl_c handler` and it's totally fixable. - [x] `Enabled` is a sensible default for WSL because it works on linux builds in Windows Terminal too > Solved by introducing heuristic based on environment variable set by terminal - [x] Downloading stage may produce unpleasant blinking due to a rapid 0-100 changes > Solved by not displaying bar when downloading and using indeterminate state in other cases so amination don't reset ### TLDR * An `term.progress.taskbar` option with bool type is added * On Windows Terminal and ConEmu is enabled by default * If enabled reports build progress to taskbar icon and/or tab header ### Videos https://github.com/user-attachments/assets/48bb648a-e819-490e-b3ac-3502bc5f2f3a https://github.com/user-attachments/assets/1d7ddf7a-34dd-4db1-b654-e64d7170798e
This commit implements the OSC 9;4 sequence per the ConEmu style.
ESC ] 9 ; 4 ; st ; pr STstis:0: remove progress.1: set progress value topr(number, 0-100).2: set the taskbar to the "Error" state3: set the taskbar to the "Indeterminate" state4: set the taskbar to the "Warning" stateWe've also extended this with:
We handle multiple tabs sending the sequence by using the the last focused
control's taskbar state/progress.
Upon receiving the sequence in
TerminalApi, we send an event that gets caughtby
TerminalPage.TerminalPagethen fires another event that gets caught byAppHostand that's where we set the taskbar progress.Closes #3004