#!/bin/bash

# omarchy:summary=Toggle idle behavior so the system either idles normally or stays awake

if ! state=$(omarchy-shell idle toggle); then
  exit 1
fi

case $state in
enabled)
  omarchy-notification-send -g "󰾪" "Idle behavior on" "System can now lock on idle"
  ;;
disabled)
  omarchy-notification-send -g "󰅶" "Staying awake" "Idle behavior disabled"
  ;;
*)
  echo "Unexpected idle state: $state" >&2
  exit 1
  ;;
esac

omarchy-shell bar refreshIndicators >/dev/null 2>&1 || true
