#!/bin/sh pid="$(pgrep swayidle)" if [ -z "$pid" ]; then swayidle -w timeout 300 'swaylock -f -c 000000' \ timeout 300 'swaymsg "output * dpms off"' \ resume 'swaymsg "output * dpms on"' & notify-send --app-name "Autolock" "Enabled" else kill -9 "$pid" notify-send --app-name "Autolock" "DISABLED" fi