0

I would like to use command on startup to activate f.lux:

xflux -k 2200 -l 41 -g 175 -nofork

I tried couple of methods. Nothing worked. Now I try this one and it also doesn't work:

Put the command in your crontab file. The crontab file in Linux is a daemon that performs user-edited tasks at specific times and events. To edit the file, open a terminal and type "sudo crontab -e" to open your crontab file in the default text editor. At the first available line, type "@reboot xxxx", where "xxxx" is the command you wish to run. Save the file and exit.

Why

@reboot xflux -k 2200 -l 41 -g 175 -nofork

doesn't work? How can I activate f.lux on startup to not launch it manually every time?

2 Answers 2

1

Running X11 GUI applications from crontab does not usually work at all. The cron subsystem assumes that cron jobs will be run completely independent from whether the user (or any user) is logged in or not. As a consequence, a cron job won't normally have access to the GUI desktop session at all when it runs: otherwise, the cron job of user A might be able to spy on or otherwise meddle with the session of user B, which is clearly not acceptable.

(It is possible to arrange for such access if you really want, but that's not the usual way to do things, and the application would need to be aware of the fact that a different user - or no user at all - might be logged in when the application starts. Or the entire GUI subsystem might not be started yet at that point.)

You did not specify the Linux distribution and desktop environment you're using, which would have been needed to give you more detailed advice. But there is probably a way to make the command auto-start at your GUI login, however the details of that will vary considerably depending on which desktop environment (and which version of it) you're using.

If you want the the f.lux to also affect the login screen, there is probably also a way to set up a program to run at the initialization of the login screen; however, when a user logs in using the GUI, the ownership of the GUI session is transferred and the X server gets reset at that point. Either the f.lux application would need to be designed to survive that and re-establish connection to the GUI session after the ownership switch (in which case f.lux would have to run as root, which is not ideal), or you'd have to configure one instance of it for the login screen and another for the user session (either for your user account only, or as a system default for all users). The latter option is probably the simplest to implement.

1
  • I think f.lux can run after logging in. Doesn't need to be available on login screen. I will try now to launch it after specific user logs in.
    – Pochmurnik
    Commented Jan 2, 2020 at 16:36
0

You can probably try gnome-tweak-tool. Just install it using command:

sudo apt install gnome-tweak-tool

You should be able to use it to manage startup applications.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .