Did you ever have problems falling asleep after staying up late with a computer or smartphone? Most computer screens emit a blueish light by default to imitate daylight so that they appear more natural to look at. While it probably has an aesthetic advantage, it also has an unwanted side-effect.
Your sleep cycles are regulated by a hormone called melatonin which is secreted into your system in the absence of daylight. As soon as you see the sun (or rather the blue sky) in the morning, the production of the hormone stops until it gets dark again. Think about it like nature’s own sleeping draught built right into your system. Unfortunately the blue light of the screen blocks melatonin production, keeping you awake long after you have turned your screen off.
The solution would be to have the screen’s colours adjusted so there is less blue in it. Redshift is a simple tool that is capable of just that: It automatically adjusts the screen’s colour temperature according to your location and the time of day. It works much like f.lux on Windows or Mac. Redshift was in fact inspired by f.lux and is available free of charge for anyone wishing to use it.
Installing redshift on your system
Most major Linux distributions have packages built for easy installation. You would usually have two packages, “redshift” and “redshift-gtk.” The former is the basic package while the latter includes a system-tray indicator icon. To install both on a Debian-based system is as simple as looking it up in the built-in software centre of your OS or typing
into a terminal.
Finding the right colour temperature
Before configuring redshift you should play around with the colour temperature settings until you find the one most suitable, unless you want to end up with a screen looking like you have a video cable problem. To achieve this, you can use the “one shot” option, with the
For example, typing
will set the screen colour temperature to 3500K (that is °Kelvin). (The neutral screen colour is 6500K; anything lower than that will turn your screen towards a more reddish hue.)
To reset to neutral, you can use the
Of course 3500K is quite extreme. Play around with colour temperatures until you find a setting that still feels natural. It helps to have a few applications open, preferably those that have a light background, as these will show the greatest difference.
You would need to find the right settings for both daytime and night-time hours. The default values for redshift are 5500K/3500K respectively. Chances are that you will find the default daytime colour still “too red” as it is 1000K below “neutral.” If you do not want to change your usual display setting for the daytime, you can stick with 6500K and just find the ideal “redness” for the night.
To set both daytime and night-time temperatures, you can use the
would produce a less “forceful” colour change:
Adjusting screen brightness
You could also dim/brighten your screen with gamma values between 0.1 and 1.0, using the
-b switch, like
If for example, you would like to dim your screen for the night to 60% brightness, while having it on full blast during the day, you could achieve this with
which would considerably darken your screen for the night, as you can see below.
Determining geographical location
Once you have found the right colour and brightness settings, you will need some geographical data to auto-adjust to the daylight hours. Redshift can use your system’s built-in geo-location provider, so you will not need to worry about latitude and longitude details.
will tell you what providers are available on your system.
You can see above that geoclue is installed. Using it is easy:
If you do not have a location provider installed or you prefer not to use it, you can always set your latitude and longitude manually in the format of
If you don’t know your exact coordinates, you can use the Find Latitue and Longitude website to figure them out in seconds. If you are in Paris (France) for example, your coordinates would be:
Rredshift has some more advanced configuration options as well. To find out all its capabilities, use the
The full command
Now you know your desired screen colour temperature, brightness and your location. Assuming you are still in Paris, you want to have your night-time screen temperature at 5000K with the daytime setting unchanged, having full brightness during the day and 80% brightness at night, so you would type:
Or to automatically detect location:
The results are somewhat more friendly:
If you also wanted to have a tray indicator icon when Redshift is running, that will allow you to enable/disable Redshift temporarily or permanently, you can use “gtk-redshift”:
You can always check the status of Redshift by right-clicking this indicator and selecting “Info”:
Starting Redshift automatically
To have it start automatically with your system, you would add the above command to your startup applications. On a Ubuntu-based system this would be as easy as typing “startup applications” into the dash (Unity) or the activities overview (Gnome shell) search …
… select Add …
… and paste your Redshift command.
This would have Redshift start every time you boot your system and would adjust the screen according to your preferences.
Redshift is a great tool to prevent eye strain and insomnia. Of course, first you will need to get used to the slightly reddish hue of your screen at night, but that would come naturally after a few days of active use.
Our latest tutorials delivered straight to your inbox