From db9216190006f5df276946d49340be34000c8ccb Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 25 Jan 2020 14:38:19 +0100 Subject: [PATCH] xss-lock: use systemctl kill instead of extracting MainPID --- bin/xss-lock | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/bin/xss-lock b/bin/xss-lock index 1dcebac..fcc8c9c 100755 --- a/bin/xss-lock +++ b/bin/xss-lock @@ -20,13 +20,8 @@ case "$1" in ;; dim|notify) echo "notify: start" - redshift=$(systemctl --user show \ - --property MainPID \ - --value redshift@$(systemd-escape -- "$DISPLAY").service) - [ x$redshift = x ] || { - kill -STOP $redshift - trap "kill -CONT $redshift" EXIT - } + systemctl --user kill -s STOP redshift@$(systemd-escape -- "$DISPLAY").service + trap "systemctl --user kill -s CONT redshift@$(systemd-escape -- "$DISPLAY").service" EXIT trap 'echo notify: user activity; kill %% 2> /dev/null; exit 0' HUP # user activity trap 'echo notify: locker started; kill %% 2> /dev/null; exit 0' TERM # locker started outputs=($(xrandr -q | sed -n 's/\([^ ]*\) connected .*/\1/p'))