microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.51k stars 8.31k forks source link

Feature Request: Reduce cursor blinking to save battery life #5318

Open Austin-Lamb opened 4 years ago

Austin-Lamb commented 4 years ago

Description of the new feature/enhancement

In several more modern UI experiences in Windows, the blinking cursor effect has been changed to reduce battery impact - I'm proposing Terminal should do the same. The cursor stops blinking after a period of inactivity to save on the amount of CPU/GPU cycles spent running the animation, updating the graphics, updating the screen, stuff like that.

To see an example of this in action, use Outlook. Start writing an e-mail, type a little bit, then pause your typing for several seconds. The cursor will go solid and stop blinking.

It sounds crazy that this could have a meaningful battery impact - but it certainly can. I implemented this feature in Silverlight for Windows Phone, and my team did it for XAML in UWP. In both cases the battery impact far exceeded my expectations - and this is no doubt why Outlook did it too.

Proposed technical implementation details (optional)

The way this works in XAML, Outlook, etc. is that a 5 second timer is started after a key is let up. At the end of that 5 seconds the cursor is set to a solid 'on' state. Note that the cursor stays solid while you type too, so it stays in this 'on' state until you pause, then blinks for a few seconds, then goes back to solid.

This may have extra complexity in terminal due to block cursors and stuff like that, but it would be the rough sketch of what to do.

zadjii-msft commented 4 years ago

Sounds good to me

Poopooracoocoo commented 3 years ago

@Austin-Lamb Have you also requested this for Edge or Chromium? If every win32 app did this it'd be great for battery life. Battery life on Windows is pretty bad compared to GNOME and KDE and apparently macOS.

Austin-Lamb commented 3 years ago

@Poopooracoocoo - I had not, but I love your suggestion. I filed this issue on Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=1163161

Since Edge is now based on Chromium, if it were fixed there I think it would benefit both Chrome and Edge, as well as other Chromium-based things like Electron.

Thanks for the suggestion to file this!

lhecker commented 2 years ago

I measured power draw from cursor blinking with the new text rendering engine (AtlasEngine), which is likely to become the new default in the future. Unlike the current text renderer it redraws the entire frame every time. This results in a reduced CPU and increased GPU usage.

As a result, on my 1st gen Surface Book (Intel i7 6600U), cursor blinking results in a consistent GPU usage of 1.2%, or around 0.03W. Counter-intuitively on my desktop system (Nvidia RTX 3080) the difference in power draw is greater, at around 7W. (This one is hard to measure, due to the GPU being much more performance oriented.)

I measured (or rather estimated) this using HWiNFO64.

zadjii-msft commented 2 years ago

Autin shared with me: https://devblogs.microsoft.com/sustainable-software/measuring-your-application-power-and-carbon-impact-part-1/