1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #!/bin/sh
- if [[ $# -eq 0 ]] ; then
- echo "lock-screen [ enable | disable | suspend | lock | start ]"
- exit
- fi
- case ${1} in
- locker-command)
- i3lock -c 536a77 -e -f -n
- ;;
- locker-command-fork)
- i3lock -c 536a77 -e -f
- ;;
- lock)
- ssh-add -D
- xidlehook-client --socket ~/.xidlehook.sock \
- control --action trigger --timer 0
- ;;
- daemon)
- [ -e ~/.xidlehook.sock ] && rm ~/.xidlehook.sock
- echo "Starting xidlehook"
- echo "DISPLAY=${DISPLAY}"
- 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
- tmu -e screenlocker screenlocker 'lock-screen daemon'
- fi
- if ! ps aux | grep '[-]-member Lock' > /dev/null ; then
- tmu -e screenlocker dbus-lock 'lock-screen dbus-listen-lock'
- fi
- if ! ps aux | grep '[-]-member PrepareForSleep' > /dev/null ; then
- tmu -e screenlocker dbus-suspend 'lock-screen dbus-listen-suspend'
- fi
- ;;
- dbus-listen-lock)
- echo "Listening for org.freedesktop.login1.Session.Lock()"
- dbus-listen --system \
- --interface org.freedesktop.login1.Session \
- --member 'Lock' \
- lock-screen lock
- ;;
- dbus-listen-suspend)
- echo "Listening for org.freedesktop.login1.Manager.PrepareForSleep()"
- dbus-listen --system \
- --interface org.freedesktop.login1.Manager \
- --member 'PrepareForSleep' \
- lock-screen lock
- ;;
- disable)
- xidlehook-client --socket ~/.xidlehook.sock \
- control --action disable --timer 0
- ;;
- enable)
- xidlehook-client --socket ~/.xidlehook.sock \
- controll --action enable --timer 0
- ;;
- suspend)
- systemctl suspend
- ;;
- hibernate)
- systemctl hibernate
- ;;
- suspend-hibernate)
- systemctl suspend-hibernate
- ;;
- *)
- echo "lock-screen [ enable | disable | lock | start | suspend | hibernate | suspend-hibernate ]"
- esac
|