Alternatives for f.lux/redshift

Neither f.lux nor redshift works on my Ubuntu. I've installed f.lux (latest version 2010 :/), but it didn't work for some reason. The same goes for redshift; after launching it outputs Unknown location providergeoclue'.`

I've tried many solutions but none of them worked out :(

Are there any alternatives to these applications on Ubuntu?


Solution 1:

eyesome

Eyesome is a bash script running as a deamon and sleeping most of the time 24/7. It automatically adjusts screen brightness (and optionally gamma too) for your laptop display via hardware interface and up to two other monitors using xrandr's software control.

At sunrise (the time is automatically obtained from the internet each day), your screen brightness (and optionally gamma too) is adjusted gradually. The gradual adjustment is defined by you but, 120 minutes works for me. To keep the adjustments unnoticeable set a sleep interval between adjustments. Anywhere between 15 and 60 seconds is probably best and the default is 60.

After sunrise transition is complete, eyesome daemon sleeps many hours until sunset transition starts. I'm using 90 minutes before sunset but you can set any period you like.

Inversely to sunrise transition, the sunset transition gradually decreases screen brightness (and optionally gamma too) so it is unnoticeable.

Note that during nighttime transition gamma may increase. For example Red gamma may be defined as 1.0 during day and 1.2 during night to reduce eye strain. Blue gamma in turn may be defined as 1.0 during day and .8 during night so it will decrease instead.

To reduce resources, eyesome sleeps the entire period between sunset and sunrise. Depending on where you live and the season of the year, the average sleep will be 12 hours.

Eyesome Setup - Main Menu

To configure eyesome, a main menu is provided:

eyesome main menu.png

Edit Configuration - General tab

When you click the Edit button from the main menu the edit configuration general tab initially appears as shown below.

eyesome configuration general tab.png

Your country/city name should automatically appear. If necessary you can override it.

Edit Configuration - Monitor 1 tab

Clicking on Monitor 1 tab above will reveal this panel in my configuration (yours may be different):

eyesome-edit-configuration-monitor-1.png

Don't be daunted by these settings they are for the most part automatically obtained by eyesome. You will need to set the daytime and night brightness/levels though.

Edit Configuration - Monitor 3 Tab

Clicking on Monitor 3 Tab reveals this panel in my configuration (yours may be different):

Monitor 2 Tab is not shown because it is a new TV with adaptive brightness and Smart OS. It requires no overrides by Eyesome.

enter image description here

If after eyesome is installed you attach a different monitor to your system you may have to enter the xrandr monitor name.

Eyesome Setup - 5 second test

From the main menu you can test your daytime and nighttime brightness and gamma settings for 5 seconds by clicking the Daytime and Nighttime buttons respectively. You can change the duration of the test from 5 seconds up to 20 seconds from the Edit Configuration - General Tab.

Here's what the 5 second Nighttime test looks like:

eyesome nighttime test.gif

Unusual event handling

Assume you suspend your laptop when it's morning before work and the screen is at full dim. You come home after work when the sun is high in the sky and open your laptop. The screen is so dim you can't read it.

To address this scenario a systemd control file is provided:

  • /etc/systemd/system-sleep/systemd-wake-eyesome control file is called whenever the system suspends or resumes.
  • The control file calls the bash script /usr/local/bin/wake-eyesome.sh to reset brightness to full and then sleep until sunset transition.

You are watching a movie on your external TV at night and close your laptop lid for better viewing. Ubuntu / Lightdm / xrandr takes a few seconds and then resets your external TV to full full brightness. OUCH to your eyes.

To address this scenario an acpi event control file is provided:

  • /etc/acpi/event/lid-event-eyesome control file is called whenever the laptop lid is opened or closed.
  • The control file calls the bash script /etc/acpi/acpi-lid-eyesome.sh to handle the lid opening and closing.
  • In turn the eyesome bash script calls /usr/local/bin/wake-eyesome.sh to reset brightness for nighttive viewing and then sleeps until sunset transition.

Summary

Eyesome can be downloaded from: https://github.com/WinEunuuchs2Unix/eyesome

This program was just released in September 2018 so please let me know if you find any problems or have suggestions for improvement.

The documentation phase is just starting so don't hesitate to ask any questions. Your questions may even result in documentation improvements.

Solution 2:

Redshift

Although not an alternative but maybe a ways to fix Redshift for you. Redshift error message you are getting can easily be prevented by providing a manual geo-location via an Redshift configuration file in your home directory. here an example redshift.conf file, which should be put into ~/.config/ directory:

; Global settings for redshift
[redshift]
; Set the day and night screen temperatures (Neutral is 6500K)
temp-day=5750
temp-night=4750

; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature.
; 1 will gradually increase or decrease the screen temperature.
transition=1

; Set the screen brightness. Default is 1.0.
;brightness=0.9
; It is also possible to use different settings for day and night
; since version 1.8.
;brightness-day=0.7
;brightness-night=0.4
; Set the screen gamma (for all colors, or each color channel
; individually)
gamma=0.8
;gamma=0.8:0.7:0.8
; This can also be set individually for day and night since
; version 1.10.
;gamma-day=0.8:0.7:0.8
;gamma-night=0.6

; Set the location-provider: 'geoclue2' or 'manual'
; type 'redshift -l list' to see possible values.
; The location provider settings are in a different section.
location-provider=manual

; Set the adjustment-method: 'randr', 'vidmode'
; type 'redshift -m list' to see all possible values.
; 'randr' is the preferred method, 'vidmode' is an older API.
; but works in some cases when 'randr' does not.
; The adjustment method settings are in a different section.
adjustment-method=randr

; Configuration of the location-provider:
; type 'redshift -l PROVIDER:help' to see the settings.
; ex: 'redshift -l manual:help'
; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
; are negative numbers.
[manual]
lat=52.32510
lon=7.58050

; Configuration of the adjustment-method
; type 'redshift -m METHOD:help' to see the settings.
; ex: 'redshift -m randr:help'
; In this example, randr is configured to adjust screen 1.
; Note that the numbering starts from 0, so this is actually the
; second screen. If this option is not specified, Redshift will try
; to adjust _all_ screens.
;[randr]
;screen=1

Especially two parts need to be changed and adapted to your situation:

; Set the location-provider: 'geoclue2' or 'manual'
; type 'redshift -l list' to see possible values.
; The location provider settings are in a different section.
location-provider=manual

This one points usually to geoclue as location provider and youshl be changed to manual.

And the second part is the configuration for the geoprovider which you can easily set yourself by copying/pasting the location you have from https:/maps.google.com :

; Configuration of the location-provider:
; type 'redshift -l PROVIDER:help' to see the settings.
; ex: 'redshift -l manual:help'
; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
; are negative numbers.
[manual]
lat=52.32510
lon=7.58050