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

Flashing the window title (and the task bar) via FlashWindowEx has no effect #8713

Closed
UweKeim opened this issue Jan 6, 2021 · 6 comments
Closed
Labels
Issue-Question For questions or discussion Needs-Tag-Fix Doesn't match tag requirements Resolution-Answered Related to questions that have been answered

Comments

@UweKeim
Copy link

UweKeim commented Jan 6, 2021

Environment

Windows build number: Microsoft Windows [Version 10.0.19042.685]
Windows Terminal version: 1.4.3243.0

Any other software? Any program that flashes the window title like e.g. my own tool to do so: https://github.com/UweKeim/console-flasher

Steps to reproduce

I'm trying to acchieve that when a program, that runs in a CMD instance inside Windows Terminal, does makes a call to the FlashConsoleEx Windows API call, the flashing of both the window title and the task bar icon of Windows Terminal does happen.

  1. Open a new Terminal instance with a cmd tab (i.e. no PowerShell)
  2. Run a program that flashes the window title (and also the task bar icon)

Expected behavior

The window title and the task bar icon of Windows Terminal flashes.

Actual behavior

The window title and the task bar icon of Windows Terminal does not flash.

Additional remarks

Try running a program that flashes the window title in a regular cmd.exe (i.e. not in Windows Terminal) to see a live example of the expected behaviour.

@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 Jan 6, 2021
@zadjii-msft
Copy link
Member

Ah, this is another one of those things that won't work in Windows Terminal because conpty is returning garbage for the result of GetConsoleWindow. (Another one of these is #2988). That's one of the APIs that we're trying to discourage users from using in the future, because it won't work cross-platform, and it won't work in remote scenarios (like ssh).

One of the things we are working on is a VT sequence version of this functionality. Have a look at #6700. I'm not sure it does taskbar flashing, per say, but we can set the "progress" state of the window. I'm gonna tag in @PankajBhojwani to see if he has any other thoughts on the matter.

@PankajBhojwani
Copy link
Contributor

What zadjii-msft said! We do already have the infrastructure in place to flash the taskbar (#8215 added the ability to flash the taskbar when BEL is emitted) so adding a VT sequence for this should be straightforward I think

@DHowett
Copy link
Member

DHowett commented Jan 6, 2021

We may want to avoid having our own VT sequence for stuff like this. The bell, or the ConEmu Progress API (OSC 9;4) should be sufficient and more expressive. 😄

Whether the window flashes is a user preference, and no application should be able to override that.

@DHowett
Copy link
Member

DHowett commented Jan 6, 2021

(Closing as answered, but do feel free to continue the discussion!)

@DHowett DHowett closed this as completed Jan 6, 2021
@DHowett DHowett added Issue-Question For questions or discussion Resolution-Answered Related to questions that have been answered and removed Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jan 6, 2021
@ghost ghost added the Needs-Tag-Fix Doesn't match tag requirements label Jan 6, 2021
@UweKeim
Copy link
Author

UweKeim commented Jan 7, 2021

Trying to get my head around the (to me rather new) concept of "VT sequences" (short for "Virtual Terminal Sequences"), here are some resourcen about that topic.


Basic example:

Console.WriteLine("\u001b[31mHello World!\u001b[0m");

This code would set the color of the text to red through the escape sequence ESC[31m. (31 for red), prints "Hello World!" and then finally uses ESC[0m to reset the color.

As another example the following would position the cursor two lines up, by using the escape sequence ESC[2A.

Console.Write("\u001b[2A");

For the Bell VT sequence (^G, as described in #8215) I did not get it to work with this:

Console.Write("\u001b[G");

and also not with this:

Console.Write("\a");

But probably the reason it is not yet working is that my version of Windows Terminal does not yet include #8215.


I hope this helps others in the future, too.

@UweKeim
Copy link
Author

UweKeim commented May 22, 2022

One and a half year later, this still does not work, as #8215 still seems to be not included, not even in the Preview of Windows Terminal. Sad.


Edit 1

It seems it is possible now by using e.g. this from a C# console application:

Console.Write("\a");

See this comment of mine for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Question For questions or discussion Needs-Tag-Fix Doesn't match tag requirements Resolution-Answered Related to questions that have been answered
Projects
None yet
Development

No branches or pull requests

4 participants