Skip to content

Conversation

@dkondor
Copy link

@dkondor dkondor commented Jan 17, 2018

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 :)

Daniel Kondor added 2 commits January 14, 2018 21:20
to a FIFO (named pipe)

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 too
they would not work and cause the build to fail
@jonls
Copy link
Owner

jonls commented May 6, 2018

Thanks for looking into this. I'd much prefer not having to maintain a custom protocol for this though. I think this should be implemented through dbus. There's already a lot of discussion and some work done on this in #54.

@jonls jonls closed this May 6, 2018
@dkondor dkondor deleted the origin/brightness-adjust branch January 14, 2020 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants