Browse Source

Update lock-screen command

Samuel W. Flint 2 years ago
parent
commit
40cacb2215
1 changed files with 11 additions and 2 deletions
  1. 11 2
      lock-screen

+ 11 - 2
lock-screen

@@ -17,13 +17,22 @@ case ${1} in
         xidlehook-client --socket ~/.xidlehook.sock \
                          control --action trigger --timer 0
         ;;
-    start)
-        rm ~/.xidlehook.sock
+    daemon)
+        [ -e ~/.xidlehook.sock ] && rm ~/.xidlehook.sock
+        echo "Starting xidlehook"
         xidlehook --socket ~/.xidlehook.sock \
                   --not-when-fullscreen \
                   --not-when-audio \
+                  --detect-sleep \
                   --timer 300 "lock-screen locker-command" ""
         ;;
+    start)
+        if ! ps aux | grep ' [x]idlehook ' > /dev/null ; then
+            if ! tmux has-session -t 'screenlocker' ; then
+                tmux new-session -s 'screenlocker' -n 'screenlocker' -d "$SHELL -c 'lock-screen daemon'"
+            fi
+        fi
+        ;;
     disable)
         xidlehook-client --socket ~/.xidlehook.sock \
                          control --action disable --timer 0