46

I have installed Redshift on my computer and it works fine with the command gtk-redshift.

However, it would not start up automatically when using the same command in startup applications.

How do I set it to automatically start?

27

There is a known bug #868904 that stops Redshift starting automatically in 11.10 due to geoclue conflicts on startup.

See Comment #17 on the bug report for a possible solution of setting the location permanently on start up.

1) Use http://itouchmap.com/latlong.html or any other service to find your latitude/longitude

2) Adjust the startup command of redshift to: gtk-redshift -l <latitude>:<longitude>

Example of latitude/longitude of Amsterdam for redshift: gtk-redshift -l 52.37:4.9

It is reportedly fixed in the package 1.7-1ubuntu2 but the Launchpad homepage for the project lists only 1.7-0ubuntu1 built 35 weeks ago.

You could try downloading direct from their website to see if it fixes the issue with a later version.

  • would it start if I used the GNOME-clock method? – Dandyman Mar 10 '12 at 21:11
  • I'm not sure, you could try it but the steps outlined above apparently work.. – Mark Rooney Mar 10 '12 at 21:17
  • I've now tried it with both the gnome-clock and manual methods, and it won't start on either – Dandyman Mar 12 '12 at 18:54
  • Well if you have tried the method above and it does not work I'm out of suggestions. As I said this is a bug in Redshift so you may well just have to wait for it to be resolved by the Redshift developer. – Mark Rooney Mar 13 '12 at 20:38
  • This problem also occurs with 14.04 and your second option worked well for me. Thanks. – Ébe Isaac Oct 4 '17 at 9:01
14

Create a file named redshift.conf in ~/.config and add your co-ordinates to it. It should end up looking something like this:

[redshift]
location-provider=manual
[manual]
lat=55.0
lon=12.0
  • This worked for me with redshift-gtk v1.7 (set to autostart) on Trusty. – Arch Stanton Jan 14 '16 at 1:01
9

I would suggest two ways:

  1. Using crontab
  2. Using upstart

CRONTAB

Crontab is a program that is running all the time. It has a list with programs and scripts and the exact dates or intervals that they should run. Crontab is used a lot by system administrators for making backups and automating tasks.

To see the list with the programs you can type

crontab -l

To edit the list type

crontab -e

Add this line in the end, to boot redshift whenever computer starts up

@reboot export DISPLAY=:0.0 && /usr/bin/redshift -l 56.20:16.35

where 56.20:16.35 is the LATITUDE:LONGITUTE of your location. Save and reboot.

UPSTART

Upstart is a program that amongst other things, looks in specific folders at bootup for scripts to be run. So we can just add our program in there to have it run in every booutup. Upstart is more low-level than crontab and you need root privileges.

To add redshift you simply have to edit /etc/rc.local file. Add the path to redshift before the exit in the file or else it won't run. You can find the path by typing whereis redshift. The file should look similar to this:

#!/bin/sh -e
pcscd
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/usr/bin/redshift

exit 0

Save and reboot.

  • On my Ubuntu 14.04, neither approach works. In particular with the crontab approach, I can see in syslog that the command is run, there is no error message, but the process is gone by the time login screen comes up. (That is, there is no visual effect of Redshift running, and after login I can confirm that there is indeed no redshift process running.) – Raphael Feb 8 '16 at 18:34
  • 1
    This post suggests that both the approaches you propose are doomed to fail. Did you actually confirm that they work (in more than one setup)? For instance, I have checked that $DISPLAY is sometimes :0 and sometimes :0.0 for me, so how can I hardcode a value? – Raphael Feb 8 '16 at 18:46
  • Should have checked whether this actually works before upvoting. As @Raphael 's comment says, this doesn't work at all. Now I can't remove my upvote! 😒 – jamadagni Nov 22 '18 at 13:57
2

Connect your computer to internet and run gtk-redshift in Terminal.

The output will be:


maez@maez:~$ gtk-redshift
Trying location provider `geoclue'...
Started Geoclue provider `Geoclue Master'.
Using provider `geoclue'.

** (process:3541): WARNING **: Could not get location, 3 retries left.

According to the geoclue provider we're at: 18.98, 72.83
Using method `randr'.

Once you get your Latitude and Longitude from above, Go ahead and Edit autostart config file for Redshift, which is found in "~/.config/autostart/"


maez@maez:~$ cd .config/autostart/
maez@maez:~/.config/autostart$ gedit redshift-gtk.desktop

In gedit window add "-l 18.98:72.83" next to "Exec=redshift-gtk"


[Desktop Entry]
Comment=Color temperature adjustment tool
StartupNotify=true
Exec=redshift-gtk -l 18.98:72.83
Terminal=false
GenericName=Color temperature adjustment
Version=1.0
Categories=Utility;
Hidden=false
Icon=redshift
Type=Application
X-GNOME-Autostart-enabled=true
Name=Redshift

where 18.98:72.83 is your LATITUDE:LONGITUTE

Save this file and Reboot.

  • 2
    One can just cp /usr/share/applications/redshift.desktop ~/.config/autostart/ – Gayan Weerakutti Sep 19 '18 at 14:22
1

Antoher workaround (comment #53) is to install geoclue-hostip.

Even though on my setup (Ubuntu 13.04) the manual position workaround works, and I prefer it anyway because it allows me to indicate the location more precisely.

1

Quite an old question, but for those who might stumble upon it, a possible solution may simply be by removing geoclue and --if it doesn't already exist-- installing geoclue-2.0

Something like: apt remove geoclue && apt install geoclue-2.0

Logout and log back in to see the changes.

p.s. if the colors are not telling, you can check whether redshift is running using the ps command. e.g. ps aux | grep redshift

0

Another one way is to set up startup command for redshift with manually specified lon:lat like:

redshift-gtk -l xx:yy

where xx - latitude, yy - longitude

Startup Application Screen:

Tested on Ubuntu 14.04LTS

0

Create the file ~/.xprofile with the following content:

#!/bin/sh
sleep 10 && redshift -PO 4200 &

The xprofile is executed at the beginning of the X user session, after you log in to the graphical shell (Unity or Gnome).

The command redshift -PO 4200 sets the temperature to 4200K.

You can test the script by logging out and then logging in.

  • Why sleep 10 seconds? – KajMagnus Aug 25 '18 at 20:49
  • 1
    @KajMagnus To be effective, redshift should be ran after some other processes finished. – golopot Aug 26 '18 at 11:46
0

Another way to do it:

  1. create a config file, e.g. /etc/redshift.conf

    [redshift]
    location-provider=manual
    
    [manual]
    lat=xx.xxx
    lon=yy.yyy
    
  2. create a script that calls this file, e.g. /usr/local/bin/redshift.sh (chmod 755 afterwards)

    redshift -c  /etc/redshift.conf &
    
  3. call this whenever the display manager starts. For LightDM, this would be a file at /etc/lightdm/lightdm.conf.d/90-redshift.conf:

    [Seat:*]
    display-setup-script=/usr/local/bin/redshift.sh
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.