aboutsummaryrefslogtreecommitdiff
path: root/modules/services
diff options
context:
space:
mode:
authorGregory C. Oakes <gregoryoakes@fastmail.com>2020-02-01 10:17:58 -0800
committerRobert Helgesson <robert@rycee.net>2020-02-02 01:33:36 +0100
commit6cc4fd6ede4909226cb81d3475834251ed1b7210 (patch)
treef42b07a68905cfcebbf29ac51162999b663ace1d /modules/services
parent115e76ae12a81bce5dcd19714cdeaaa8d5ca3ce8 (diff)
screen-locker: made xss-lock a systemd service.
Takes advantage of the new `--session` xss-lock parameter to allow xss-lock be made into a systemd service. PR #1015
Diffstat (limited to 'modules/services')
-rw-r--r--modules/services/screen-locker.nix21
1 files changed, 15 insertions, 6 deletions
diff --git a/modules/services/screen-locker.nix b/modules/services/screen-locker.nix
index 2d0fc758870..30591a7d1a5 100644
--- a/modules/services/screen-locker.nix
+++ b/modules/services/screen-locker.nix
@@ -65,12 +65,21 @@ in {
};
};
- # xss-lock will run specified screen locker when the session is locked via loginctl
- # can't be started as a systemd service,
- # see https://bitbucket.org/raymonad/xss-lock/issues/13/allow-operation-as-systemd-user-unit
- xsession.initExtra = "${pkgs.xss-lock}/bin/xss-lock ${
- concatStringsSep " " cfg.xssLockExtraOptions
- } -- ${cfg.lockCmd} &";
+ systemd.user.services.xss-lock = {
+ Unit = {
+ Description = "xss-lock, session locker service";
+ After = [ "graphical-session-pre.target" ];
+ PartOf = [ "graphical-session.target" ];
+ };
+
+ Install = { WantedBy = [ "graphical-session.target" ]; };
+
+ Service = {
+ ExecStart = concatStringsSep " "
+ ([ "${pkgs.xss-lock}/bin/xss-lock" "-s \${XDG_SESSION_ID}" ]
+ ++ cfg.xssLockExtraOptions ++ [ "-- ${cfg.lockCmd}" ]);
+ };
+ };
};
}