#!/bin/bash

TERM_CMD="foot -T float"
LOCK_CMD="$HOME/.config/sway/bin/sway_lock"
SUS_CMD="$HOME/.config/sway/bin/sway_suspend"

### Idle configuration
#   10 min    screen off
#   15 min    lock
#   30 min    suspend on battery
#  120 min    suspend
pkill -x swayidle
swayidle -w \
    timeout 1500 "$TERM_CMD bash -c 'dunstify -r 123 -u critical display\ will\ turn\ off\ soon'" \
    resume "$LOCK_CMD on" \
    timeout 1800 "$LOCK_CMD off" \
    timeout 2700 "$LOCK_CMD lockonly" \
    timeout 3600 "$SUS_CMD suspend-battery" \
    timeout 7200 "$SUS_CMD suspend" \
    before-sleep "$LOCK_CMD lock"
