From c1026be5bb51dd21d182fe545155b70adc869d61 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Fri, 20 Mar 2020 10:59:56 +0100 Subject: Set redshift to run after graphical-sesion.target The previous reference (`display-manager.service`) is not something that's included with systemd. While it may be present on some user's system (because they created it, or some specific package includes it), it can't be expected to be present. On the other hand, `graphical-session.target` is included with systemd, and can be expected to be there, and be triggered when starting a graphical session. This guarantees that redshift will only run AFTER a graphic session is up (eg: either Xorg or Wayland are up). --- data/systemd/redshift-gtk.service.in | 2 +- data/systemd/redshift.service.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/systemd/redshift-gtk.service.in b/data/systemd/redshift-gtk.service.in index 4675ccf..439d90e 100644 --- a/data/systemd/redshift-gtk.service.in +++ b/data/systemd/redshift-gtk.service.in @@ -1,7 +1,7 @@ [Unit] Description=Redshift display colour temperature adjustment (GUI) Documentation=http://jonls.dk/redshift/ -After=display-manager.service +After=graphical-session.target [Service] ExecStart=@bindir@/redshift-gtk diff --git a/data/systemd/redshift.service.in b/data/systemd/redshift.service.in index bc51514..59db2e5 100644 --- a/data/systemd/redshift.service.in +++ b/data/systemd/redshift.service.in @@ -1,7 +1,7 @@ [Unit] Description=Redshift display colour temperature adjustment Documentation=http://jonls.dk/redshift/ -After=display-manager.service +After=graphical-session.target [Service] ExecStart=@bindir@/redshift -- cgit v1.2.3-70-g09d2 From 8bc937a700b9dadef0b7085fb9e792af18530bf9 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Fri, 20 Mar 2020 11:01:58 +0100 Subject: Change services to by wanted by graphical-session The previous value (`default.target`) meant that redshift got started when a user session began, at which point we can't expect a graphic session to be up and running (eg: Xorg or Wayland may have not even been invoked yet). Setting `WantedBy=graphical-session.target` ensures that, when the service is enable, it'll only get run when starting a graphical session (again, either Xorg or Wayland, whatever DE's may be used). --- data/systemd/redshift-gtk.service.in | 2 +- data/systemd/redshift.service.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/systemd/redshift-gtk.service.in b/data/systemd/redshift-gtk.service.in index 439d90e..79e6165 100644 --- a/data/systemd/redshift-gtk.service.in +++ b/data/systemd/redshift-gtk.service.in @@ -8,4 +8,4 @@ ExecStart=@bindir@/redshift-gtk Restart=always [Install] -WantedBy=default.target +WantedBy=graphical-session.target diff --git a/data/systemd/redshift.service.in b/data/systemd/redshift.service.in index 59db2e5..aad31ca 100644 --- a/data/systemd/redshift.service.in +++ b/data/systemd/redshift.service.in @@ -8,4 +8,4 @@ ExecStart=@bindir@/redshift Restart=always [Install] -WantedBy=default.target +WantedBy=graphical-session.target -- cgit v1.2.3-70-g09d2 From 6ceecc4aebabfd8849733911edff16ca9a68e424 Mon Sep 17 00:00:00 2001 From: Hugo Osvaldo Barrera Date: Fri, 20 Mar 2020 11:11:20 +0100 Subject: Add a FAQ entry on issues with running via systemd Fixes #742 --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 453b32a..e5ff74c 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,18 @@ Please go to [the issue tracker](https://github.com/jonls/redshift/issues) and check if your issue has already been reported. If not, please open a new issue describing you problem. + +**When running as a systemd service, redshift fails to connect to +Xorg/Wayland** + +You need to export your environment variables when you window manager or +compositor start up. Typically, you want to run this as part of its startup: + + systemctl --user import-environment; systemctl --user start graphical-session.target + +See your compositor's (or window manager's) documentation for further details +of setting up the systemd user session. + Latest builds from master branch -------------------------------- -- cgit v1.2.3-70-g09d2