#!/bin/bash statecon=$(pidof swayidle | grep "[1234567890]") if [ "$statecon" != "" ]; then notify-send -t 1000 "Caffeine mode ON — idle inhibited" killall swayidle else notify-send -t 1000 "Caffeine mode OFF — idle active" swayidle -w \ timeout 300 'swaylock -f' \ timeout 600 'systemctl suspend' \ before-sleep 'swaylock -f' & fi