jonls / redshift

Redshift adjusts the color temperature of your screen according to your surroundings. This may help your eyes hurt less if you are working in front of the screen at night.
http://jonls.dk/redshift
GNU General Public License v3.0
5.92k stars 429 forks source link

Redshift Behaves like a Virus. #794

Open edbird opened 3 years ago

edbird commented 3 years ago

Describe the bug

Redshift behaves like a virus. I cannot quit redshift. When I try to quit, it just restarts.

To Reproduce Steps to reproduce the behavior:

  1. Right click tray icon
  2. Quit
  3. Repeat

Expected behavior Redshift should quit. It does not. It restarts.

Error output/logs/screenshots If applicable, add screenshots to help explain your problem.

Software versions (please complete the following information):

AlessioGiambrone commented 3 years ago

Happens here as well, but while raising an error that ends in a popup window that gets automatically focused by the WM in a really, really annoying manner.

error message

I would add that, but this is another issue:

mosbasik commented 3 years ago

This is likely because redshift is being started by an enabled systemd unit file. To confirm, run the following:

systemctl list-unit-files --user

and check to see whether redshift-gtk.service or redshift.service say "enabled" in the STATE column.

To keep redshift from relaunching every time it dies, run the following (probably using redshift-gtk.service, but you can do it for both services if you want):

systemctl --user disable --now redshift-gtk.service

To undo the changes caused by the above command (should you want/need to), you would run:

systemctl --user enable --now redshift-gtk.service

Warning: I have no idea how this interacts with the "Autostart" checkbox in the context menu of redshift's tray widget.

andrewshadura commented 3 years ago

Just for the record, here’s the corresponding Debian issue: #979075.

taivlam commented 3 years ago

Not sure how to best assist since no explicit mentions of what desktop environments are being used, though with the help from the reply from @mosbasik, I managed to the disable systemd persistently Redshift and Redshift GTK services persistent and disable both manually. I also got some guiding points from #727, the Arch Wiki on Redshift Autostart, and a manual process of elimination of where both Redshift related system units could be located after reading this systemd section from the Arch Wiki.

(You can tell me if this method isn't recommended with systemd - I simply wanted to stop the two systemd services because the systemd services wouldn't respect the custom temperature settings that I specified when used MATE's Startup Applications. I tried the suggestion earlier here, but those commands weren't sufficient.)

Procedure

I recently solved a similar issue on Parrot OS Home (which is based on the Debian Testing) using MATE as the desktop environment. Though, this ought to work on Debian-based distros with desktop environments experiencing this issue (except GNOME, which can avoid Redshift entirely because it has Night Light built into GNOME's settings without Tweaks).

  1. Visually inspect the output of
    $ systemctl list-unit-files --user

    to determine if redshift.service and redshift-gtk.service have the status of enabled for systemd services running for the user. (Both should be enabled, as you are having this issue.)

  2. Navigate to /usr/lib/systemd/user with
    $ cd /usr/lib/systemd/user

    (This assumes you've checked there are no system units for systemd anywhere else - consult this Arch Wiki systemd section if you're unsure.)

  3. In this working directory, text files for redshift.service and redshift-gtk.service should exist. Open the former with sudo and your text editor of choice - I used Vim.
    $ sudo vim redshift.service

    This file (should be relatively short and) should have 1 line that contains Restart=always. Comment it out with a semicolon so that it looks like

    ;Restart=always
  4. Repeat Step 3 with redshift-gtk.service.
  5. Disable the Redshift and Redshift GTK service (for the current user only) with
    $ systemctl --user disable --now redshift.service
    $ systemctl --user disable --now redshift-gtk.service

    If you receive an output that the respective files for both services have been changed and suggests running

    $ systemctl --user daemon-reload

    then do so before disabling both services again with the 2 prior commands.

  6. Reboot your machine. (Perhaps logging out and logging back in is sufficient, but I wanted to make sure that all prior instances of Redshift and related things had been properly shut down.)
  7. If both Redshift related services have been manually disabled successfully, then these steps have worked. You may now use the GUI settings of your DE (except GNOME), or any other method, to launch a single instance of Redshift GTK (or plain Redshift) that won't persistently due to systemd options.
taivlam commented 3 years ago

I installed Parrot OS Home on a fresh machine, but didn't face this issue again.

A bit strange, though I can't state anything for sure due to the fact that the procedure wasn't procedurally controlled (since I immediately switched Parrot OS from its own official rolling branch to the testing branch).

All I can say that this is the order of actions I took: installed Redshift GTK, restarted the machine, added Redshift GTK to MATE's startup events as redshift-gtk -t 6500:2500, and finally restarted the machine. After this, Redshift GTK behaved just fine.

I would recommend avoid invoking Redshift via the CLI on a terminal emulator instance to avoid systemd attempting to make Redshift "immortal", especially when Redshift works best by using a GUI's/DE's startup applications menu, such as MATE or Xfce, upon login.

AlessioGiambrone commented 3 years ago

Now it seems OK on a Debian 11. Thank you

satk0 commented 3 months ago

For me on arch it is still a problem and what's more, heavily slow downs my system. Thanks to the @taivlam it is working great now :smile: