Bug 340063

Summary: Fade screen color to black before turning it off
Product: [Plasma] Powerdevil Reporter: S <sb56637>
Component: generalAssignee: Plasma Development Mailing List <plasma-devel>
Status: REOPENED ---    
Severity: wishlist CC: aleixpol, codestruct, flying-sheep, jamboarder, jpetso, kde, mgraesslin, mklapetek, natalie_clarius, nate, neptunecat34, ngompa13, notuxius, sb56637, simonandric5, voidpointertonull+bugskdeorg
Priority: NOR    
Version: 5.1.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.2.0
Sentry Crash Report:

Description S 2014-10-17 17:25:08 UTC
Hello,

I sometimes am watching something on the screen or simply reading something for a long time without moving the mouse. I have my screen set to automatically turn off after a certain time. However, when that time is reached, it just abruptly turns the screen off. It would be a much nicer exeperience if it would fade to black and allow the user to interrupt the process before the screen turns off. For me this is actually such an important feature that it currently prevents me from using Plasma, although I would like to use it.

Here are several related bugs, but not exactly the same, given that Plasma 5 is now out and there is no longer a screensaver mechanism.
Bug #183119
Bug #86683

Thanks!

Reproducible: Always
Comment 1 Philipp Stefan 2014-12-23 11:53:27 UTC
Valid criticism. Having it fade to warn the user that the screen is about to turn off is a sensible thing to do.

A go from me.
Comment 2 Kai Uwe Broulik 2014-12-24 12:37:55 UTC
Martin, could (should) we abuse the KScreen effect for this?

(Though watching a movie, for instance, should inhibit turning off the screen ;)
Comment 3 Philipp A. 2014-12-25 15:16:19 UTC
> watching a movie, for instance, should inhibit turning off the screen

it definitely should and it’s definitely annoying and unbelievable that there is still no simple X hint for this that is used and recognized everywhere. (not blaming anyone here of course!)
Comment 4 Martin Klapetek 2014-12-26 00:16:26 UTC
>  Though watching a movie, for instance, should inhibit turning off the screen ;)

In an ideal world, yes. But there's still YouTube and dozens of other flash video players where this just don't work. What makes it worse is that because normal players do inhibit, you often forget that flash players don't (no difference in full screen videos) and you get reminded by your screen going suddenly off ;)
Comment 5 Andrew Lake 2014-12-29 17:07:02 UTC
I think the fade would be helpful in a utilitarian sense, and also add to the overall visual polish. I'll confirm assuming there are no technical hurdles.
Comment 6 Martin Flöser 2015-01-02 08:29:58 UTC
(In reply to Kai Uwe Broulik from comment #2)
> Martin, could (should) we abuse the KScreen effect for this?

certainly
Comment 7 Kai Uwe Broulik 2015-01-07 18:23:01 UTC
Git commit ef0171a65637f2e63ba71ea7742209e46752c2d1 by Kai Uwe Broulik.
Committed on 07/01/2015 at 18:20.
Pushed by broulik into branch 'master'.

Add KScreen fade effect connector for PowerDevil

This is an implementation of the client side of the KScreen effect for PowerDevil
which will allow it to fade the screen before going to sleep.

REVIEW: 121798
FIXED-IN: 5.2.0

M  +17   -12   daemon/CMakeLists.txt
M  +3    -0    daemon/config-powerdevil.h.cmake
A  +156  -0    daemon/kwinkscreenhelpereffect.cpp     [License: GPL (v2+)]
A  +81   -0    daemon/kwinkscreenhelpereffect.h     [License: GPL (v2+)]

http://commits.kde.org/powerdevil/ef0171a65637f2e63ba71ea7742209e46752c2d1
Comment 8 Kai Uwe Broulik 2015-01-07 19:29:32 UTC
Git commit 196e952b0040f48e0d18bf7d97224a0221d669a3 by Kai Uwe Broulik.
Committed on 07/01/2015 at 19:28.
Pushed by broulik into branch 'master'.

Fade screen before turning it off

3 seconds before the screen will be turned off by DPMS the screen will fade to black
to alert the user. Especially older desktop monitors tend to take quite some time to
wake up again. So a user moving his mouse in panic can prevent this now :)
FIXED-IN: 5.2.0

M  +2    -2    daemon/actions/dpms/CMakeLists.txt
M  +14   -4    daemon/actions/dpms/powerdevildpmsaction.cpp
M  +7    -0    daemon/actions/dpms/powerdevildpmsaction.h

http://commits.kde.org/powerdevil/196e952b0040f48e0d18bf7d97224a0221d669a3
Comment 9 S 2016-06-03 15:53:21 UTC
Hi, was this fix actually implemented in a Plasma release? On 5.6 in openSUSE I'm seeing a very quick fade, probably under 500ms, which looks slick but doesn't accomplish the purpose of this bug report, namely, to give the user time to cancel the screen turning off.
Comment 10 Kai Uwe Broulik 2016-06-03 15:55:26 UTC
It fades 8 seconds before actually turning off, so you can still prevent the screen from turning off by wiggling the mouse.
Comment 11 S 2016-06-03 16:04:36 UTC
Thanks for the reply. Does something need to be done to enable this?
Comment 12 Kai Uwe Broulik 2016-06-13 09:49:30 UTC
Compositing needs to be enabled and the "KScreen helper effect" in Desktop Effects enabled (only shown when you uncheck the "Exclude internal desktop effects" in the menu next to the search field). However, the effect should be enabled by default.

The fade itself is pretty quick (might need to re-think that a bit and slowly fade) but the screen won't turn off right after the fade effect.
Comment 13 S 2016-12-19 19:35:57 UTC
OK, it looks like I'm seeing the fade, but it definitely seems too fast. The idea in my opinion is not just to make it aesthetic, but to give the user an alert that it's about to turn off so it can be interrupted. I'd like to see an interval of about 5 seconds.
Comment 14 Christoph Feck 2016-12-21 00:59:59 UTC
The screen is not turned off immediately once it is black, see commend #10.
Comment 15 S 2016-12-21 01:30:08 UTC
Hi, I have to take back my last comment, I'm not seeing any fading. The screen goes from full-on straight to black with no fading transition (I assume this is the lockscreen activating) and then the energy module kicks in and turns off the screen.

Where is the fade supposed to occur? Before the lockscreen or before the energy module turns off the screen?
Comment 16 Kai Uwe Broulik 2017-01-01 21:24:19 UTC
A couple of seconds before the screen turns off, no matter what is currently shown (desktop or lock screen)
Comment 17 S 2017-01-01 22:28:57 UTC
(In reply to Kai Uwe Broulik from comment #16)
> A couple of seconds before the screen turns off, no matter what is currently
> shown (desktop or lock screen)

OK, thanks for the explanation. So I can confirm that I am definitely not seeing any fading. About 5 seconds before the energy saver turns off the screen, my screen goes straight to a black screen with the backlight and mouse pointer still on. Then the screen turns off. Could you please help me diagnose why this isn't working?
Comment 18 Kai Uwe Broulik 2017-01-02 01:36:16 UTC
The fade animation is pretty quick, it's not a long fade. The "black screen with cursor still on" is indicates you actually have it working.

(I was thinking about fading the entire duration slowly but that requires some more effort, that effect wasn't actually meant to be used for this purpose. The important bit is that it gives you time to react before actually engaging energy saving from which it might take a considerable amount of time to wake up)
Comment 19 S 2017-01-02 03:55:06 UTC
Hmm I see. So I guess what I was requesting with this bug report is what mate-screensaver does, ~5 second fade to black which gives the user a chance to interrupt it before the screen goes completely black.
Comment 20 Christoph Feck 2017-01-04 21:01:22 UTC
Kai, would it be possible to fade to say 25% instead of 0%, and fade the remaining 25% a second before it is turned off? This way, the user still sees that the display is not off yet, but still is urged to move the mouse or press a key.

The entire discussion in this bug report looks like there is a misunderstanding between "black" and "off".
Comment 21 S 2017-01-04 21:15:29 UTC
(In reply to Christoph Feck from comment #20)
> The entire discussion in this bug report looks like there is a
> misunderstanding between "black" and "off".

That seems to be the issue. :-)  I should also clarify that I am referring to a fade of the screen color to black, not a change to the backlight brightness.

I personally think it should just gradually fade to black (and be interruptible by user input) during about 5 seconds.
Comment 22 Kai Uwe Broulik 2017-01-04 21:24:22 UTC
I'll have a look but that needs adjustments in KWin (needed anyway as the effect isn't supported on Wayland yet)

(a bit of Trivia: The effect that fades the screen was actually intended for KScreen to "turn off" the screen when it changes screen resolution and the like and then fade it back in once everything has settled. It was never used for this purpose. I then rediscovered the effect which has been in there since 4.10 or so and use it for communicating power management status. It's still named "KScreen Helper Effect" in Desktop Effects settings)
Comment 23 Alexander Mentyu 2017-11-26 09:18:58 UTC
Can confirm 'Screen Energy Saving' checkbox in 'Energy Saving' module involves:
1) fade-out effect - in ~0.5sec screen goes to black
2) and after that in 2-3sec screen backlight is turning off

Distribution: KDE neon Developer Edition - Stable Branches
Plasma: 5.11.3
Frameworks: 5.41.0
Qt: 5.9.2
Kernel 4.10.0-38-generic
Type: 64-bit
Comment 24 S 2017-11-26 16:12:25 UTC
@Alexander thanks for the clear explanation. In that case, could I please request that the #1 stage of fade to black be increased to about 5 seconds, or even make it user configurable in traditional KDE fashion? Thanks a lot.
Comment 25 Pedro V 2023-11-18 10:14:51 UTC
Wondered why was this still kept around, so checked out the current status:
- When there's hardware backlight control (typically on laptops), there's a "Dim screen" option which already covered this desire for me well with dimming set to 9 minutes (seconds granularity would be neat though) and switching off set to 10 minutes, but I just found out from the conversation here that there's really a fade out effect before turning the monitor off.
- When there's no hardware backlight control (typically on desktops), there's no "Dim screen" option, but surprisingly the fade out effect is present in that case too.

The fade to black effect surely seems to be surprisingly quick based on the fact that I never even realized it existed, and it surely doesn't satisfy the need expressed in the first comment.
I feel like the original desire would be already satisfied with the "Dim screen" functionality being covered by a screen effect when hardware backlight control isn't present.
Comment 26 Jakob Petsovits 2023-12-03 05:16:11 UTC
(In reply to Pedro V from comment #25)
> Wondered why was this still kept around, so checked out the current status:
> - When there's hardware backlight control (typically on laptops), there's a
> "Dim screen" option which already covered this desire for me well with
> dimming set to 9 minutes (seconds granularity would be neat though)

As an aside, you can have seconds granularity with the new Plasma 6 settings UI by replacing "9 min" by e.g. "590 sec" in the time delay textbox. The up/down arrows will continue to adjust by minutes (i.e. 60 seconds) each press, but we're not widely advertising this feature so I figure that's not a big deal.