dotfiles/gui/suspendlock.sh

23 lines
387 B
Bash
Raw Normal View History

2020-11-21 18:07:26 +00:00
#!/bin/sh
set -e
DIR=$(dirname "$(readlink -f "$0")")
. "$DIR/../env.sh"
log 'Setting up lock on suspend'
echo "
[Unit]
Description=Lock on suspend
Before=sleep.target
[Service]
ExecStart=/usr/bin/loginctl lock-sessions
ExecStartPost=/usr/bin/sleep 2
[Install]
WantedBy=sleep.target
" | sudo tee /etc/systemd/system/suspendlock.service >/dev/null
sudo systemctl enable suspendlock