Flux is nice application for those working on night time, it gives you warm color temperature on night time. I've been happily enjoying using it, link for anyone interested.
Color temperature changes on Flux started on 6PM, but rather than letting Flux modify my computer display I'd prefer turn the lights on.
This behavior makes me have to close the Flux manually, which is inconvenience.
Is there any way to make Flux only:
- Launch between 8PM to 3AM
- Stop between 3AM to 8PM
First step : create the script
First let us create a script the will be run and would enable/disable flux depending on the time (I don't knot flux syntax, so adapt it for your need). You can note that here I suppose that you need to be root to run flux, but of course if you don't just run these steps as a classical user.
and put in it something like this
Then, make it executable :
Second step : run it when needed
Now, you need to run it when needed. To to so, you can use a
cron
that would run it at 8:05 PM and 3:05 AM. But if you do so, if you open your computer at 8:10PM, it would not run it. The first solution is to usefcron
, but I don't think it's packaged on distributions, so I'll use a combinaison ofcron
and a file that runs when you open a session.To run this script with cron, run the following command. If you need to run it as root, add
sudo
before :and then type :
now, you need to be sure that the script will run when you open your session. Depending on your GUI, you can configure it in your system settings, or sometimes putting this line in
.profile
will be enough (thexhost
command is usefull to let the root user connect to the graphical interface) :Now, run it
toogleFlux.sh
to enable it for the current session :and enjoy flux !
I would like to share an alternative software that you can/should check, redshift (with its indicator
redshift-gtk
), I prefer it over flux for some reasons, foss, its on main repos, auto adjust color temp based on location/sunset time, easy manual settins (color temp, times...) , etc.From author's page:
You can simply run
sudo apt install redshift-gtk
on your terminal, and then launch it from Unity's dash. Also the indicator (a light bulb) has itself an option to make it autostart.Hope it helps.
UPDATE: As @JacobVlijm explained in comments (thanks for that), launching from cronjob seems to be not so simple as for non-GUI apps, so I changed my answer to simply show an alternative software solution.