#!/usr/bin/env bash
if ! ps aux | grep -v grep | grep swaylock; then
#        if [[ $(playerctl status) != "Playing" ]]; then
#                swayidle -w timeout 600 'loginctl suspend' &
#                SUSPEND=$!
#        fi
        swayidle -w timeout 15 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' &
        SCREENOFF=$!
        swaylock
        kill $SUSPEND $SCREENOFF
fi
