foodotfiles/home/Scripts/swayidle.sh
Marko Korhonen b026386d30
Fix swayidle after systemd move
Signed-off-by: Marko Korhonen <marko.korhonen@reekynet.com>
2020-01-10 23:45:29 +02:00

14 lines
558 B
Bash
Executable File

#!/bin/bash
swaylock="$HOME/Scripts/swaylock.sh"
dimscreen="$HOME/Scripts/dim-screen.sh"
screenon="swaymsg 'output * dpms on'"
screenoff="swaymsg 'output * dpms off'"
swayidle \
lock "$swaylock" \
timeout 300 "$dimscreen -sd" \
resume "$dimscreen -r" \
timeout 600 "loginctl lock-session $(loginctl show-user $USER -p Sessions | cut -d'=' -f2); sleep 0.5; $screenoff" \
resume "$screenon; $dimscreen -r" \
before-sleep "playerctl pause; loginctl lock-session $(loginctl show-user $USER -p Sessions | cut -d'=' -f2)" \
unlock "pkill -9 swaylock"