control brightness in a running redshift process via FIFO #576
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
addresses #129 and related
main motivation: OLED (and similar) screens do not have a backlight setting, brighness is controlled on the pixel level, AFAIK the only way to control screen brightness is with gamma ramps, which can be achieved e.g. by xrandr:
xrandr --output eDP-1 --brightness 1.0
unfortunately, this method conflicts with redshift; once redshift started, the brightness cannot be controlled any longer (redshift only supports setting to a fixed value)
this patch makes redshift 'listen' to commands for setting the brightness via a FIFO (names pipe) it creates; it can be used e.g. from external scripts to provide a way to control screen brightness, or directly from the command line
the name of the FIFO can be specified with the -B command line option
or with the brightness-fn setting in the config file
added an example script for brightness control as well, which I could successfully map to my brightness hotkeys in GNOME keyboard options
potential problems:
-- not a very 'elegant' way to do (but much simpler than doing something with e.g. dbus)
-- doing nasty things (e.g. 'yes 0.6 > /tmp/redshift-brightness'), could have bad results; for me it does not cause crash or hang anything, but seems to mess up this functionality; OOTH, any malicious program could already create similar problems by using xrandr directly
-- only works with a FIFO (that the program creates), not with a regular file
-- cannot 'read' the current value from the FIFO
Hope this could be useful for other as well :)