Bug 371494 - Support color temperature adjustments in Wayland (like Redshift in X11 or f.lux)
Summary: Support color temperature adjustments in Wayland (like Redshift in X11 or f.lux)
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: platform-drm (show other bugs)
Version: git master
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Roman Gilg
URL:
Keywords:
: 373435 379762 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-10-22 19:56 UTC by G360
Modified: 2017-12-11 10:22 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:
mgraesslin: Wayland+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description G360 2016-10-22 19:56:48 UTC
Adapting the computer's display color (adapting to the time of day or ambient light, using a sensor) improves sleep (avoiding disrupting the circadian rhythm) and helps the eyes hurt less if working in front of the screen at night or in low light condition, warm at night and colder (like sunlight) during the day.  

The American Medical Association's Council on Science and Public Health, made this recommendation:   
"Recognizes that exposure to excessive light at night, including extended use of various electronic media, can disrupt sleep or exacerbate sleep disorders, especially in children and adolescents. This effect can be minimized by using dim red lighting in the nighttime bedroom environment."

More here:
https://justgetflux.com/research.html
http://www.pnas.org/content/early/2014/12/18/1418490112.full.pdf+html

Reproducible: Always

Steps to Reproduce:
1. Blue light temperature at night
2. Eyes hurt
3. Relies you need warmer light
Comment 1 Roman Gilg 2016-11-19 16:43:52 UTC
Can confirm. Tried your steps to reproduce. Eyes hurt.

I would even go a little bit further: On X you need to install an additional plasmoid. I would like to have this feature per default in Plasma, because it's per default on Android and even activated there.
Comment 2 Christoph Feck 2016-12-08 22:44:13 UTC
*** Bug 373435 has been marked as a duplicate of this bug. ***
Comment 3 David Heidelberg 2017-03-01 10:20:06 UTC
Would be nice >
http://www.omgubuntu.co.uk/2017/02/gnome-night-light-blue-light-filter-linux
Comment 4 Roman Gilg 2017-03-01 16:20:35 UTC
I read this article (and the comments on Reddit about it ;) ).

I created this task some time ago: https://phabricator.kde.org/T4465
But I hadn't yet the time to look more into it. If anybody else wants to try to code it, I would try to give assistance to him/her.
Comment 5 G360 2017-03-15 03:20:19 UTC
In case someone is interested, sway supports this with a modified version of redshift.
https://github.com/SirCmpwn/sway/pull/1019
Comment 6 Roman Gilg 2017-03-18 16:37:40 UTC
The question is why isn't this in redshift directly? Also I would like to have this capability in KWin directly and without the user needing to install any third-party tools (maybe depend on the redshift lib, but not any fork). Any counter-arguments?
Comment 7 G360 2017-03-18 16:49:53 UTC
This is the discussion:
https://github.com/jonls/redshift/issues/55
Comment 8 Christoph Feck 2017-05-12 20:41:13 UTC
*** Bug 379762 has been marked as a duplicate of this bug. ***
Comment 9 Roman Gilg 2017-12-11 10:22:53 UTC
Git commit 82d286046907c07050ebb8c8f5c09cb60079c3ae by Roman Gilg.
Committed on 11/12/2017 at 09:58.
Pushed by romangilg into branch 'master'.

[colorcorrection] Night Color - blue light filter at nighttime

With Wayland KWin needs to provide certain services, which were provided
before that by the Xserver. One of these is gamma correction, which includes
the - by many people beloved - functionality to reduce the blue light at
nighttime. This patch provides the KWin part of that. It is self contained,
but in the end will work in tandem with a lib in Plasma Workspace and a KCM
in Plasma Desktop, which can be used to configure Night Color.

* Three modi:
** Automatic: The location and sun timings are determined automatically
   (location data updates will be provided by the workspace)
** Location: The sun timings are determined by fixed location data
** Timings: The sun timings are set manually by the user
* Color temperature value changes are smoothly applied:
** Configuration changes, which lead to other current values are changed
   in a quick way over a few seconds
** Changes on sunrise and sunset are applied slowly over the course of few
   minutes till several hours depending on the configuration
* The current color value is set immediately at startup or after suspend
  phases and VT switches. There is no flickering.
* All configuration is done via a DBus interface, changed values are tested
  on correctness and applied atomically
* Self contained mechanism, speaks directly to the hardware by setting the
  gamma ramps on the CRTC
* Currently working on DRM backend, extensible to other platform backends in
  the future
* The code is written in a way to make the classes later easily extendable to
  also provide normal color correction, as it's currently done by KGamma on X

Test Plan:
Manually with the workspace parts and added integration tests in KWin using
the virtual backend.

Reviewers: #kwin, graesslin

Subscribers: kwin, plasma-devel, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D5928

M  +19   -0    CMakeLists.txt
M  +1    -0    autotests/integration/CMakeLists.txt
A  +334  -0    autotests/integration/colorcorrect_nightcolor_test.cpp     [License: GPL (v2)]
A  +56   -0    colorcorrection/colorcorrect_settings.kcfg
A  +8    -0    colorcorrection/colorcorrect_settings.kcfgc
A  +54   -0    colorcorrection/colorcorrectdbusinterface.cpp     [License: GPL (v2)]
A  +126  -0    colorcorrection/colorcorrectdbusinterface.h     [License: GPL (v2)]
A  +288  -0    colorcorrection/constants.h     [License: GPL (v2)]
A  +50   -0    colorcorrection/gammaramp.h     [License: GPL (v2)]
A  +766  -0    colorcorrection/manager.cpp     [License: GPL (v2)]
A  +147  -0    colorcorrection/manager.h     [License: GPL (v2)]
A  +163  -0    colorcorrection/suncalc.cpp     [License: GPL (v2)]
A  +47   -0    colorcorrection/suncalc.h     [License: GPL (v2)]
A  +22   -0    org.kde.kwin.ColorCorrect.xml
M  +3    -0    platform.cpp
M  +31   -0    platform.h
M  +18   -0    plugins/platforms/drm/drm_backend.cpp
M  +6    -0    plugins/platforms/drm/drm_backend.h
M  +11   -0    plugins/platforms/drm/drm_object_crtc.cpp
M  +10   -0    plugins/platforms/drm/drm_object_crtc.h
M  +11   -0    plugins/platforms/virtual/virtual_backend.cpp
M  +12   -0    plugins/platforms/virtual/virtual_backend.h

https://commits.kde.org/kwin/82d286046907c07050ebb8c8f5c09cb60079c3ae