# ─────────────────────────────────────────────────────────────────────────────
# hypridle — idle behaviour
#
# Mirrors the GNOME power profile this replaces, exactly:
#   org.gnome.desktop.session idle-delay          = 300   (screen off at 5min)
#   org.gnome.desktop.screensaver lock-delay      = 300   (lock 5min after that)
#   org.gnome.settings-daemon.plugins.power
#       sleep-inactive-ac-type                    = nothing  (never auto-suspend)
#       power-button-action                       = nothing
#
# So: screen off at 5 minutes, lock at 10, never suspend. This is a desktop.
#
# hyprlang syntax, not Lua — hypridle is a separate project from Hyprland.
# ─────────────────────────────────────────────────────────────────────────────

general {
    # `pidof` guard prevents stacking lockers if this fires twice.
    lock_cmd = pidof hyprlock || ~/.config/quickshell/scripts/panama-lock run
    before_sleep_cmd = loginctl lock-session
    after_sleep_cmd = hyprctl dispatch 'hl.dsp.dpms({ action = "on" })'

    # 2 = auto. Holds off sleep until the locker is actually up.
    inhibit_sleep = 2
}

# 5 minutes -> screen off.
listener {
    timeout = 300
    on-timeout = hyprctl dispatch 'hl.dsp.dpms({ action = "off" })'
    on-resume = hyprctl dispatch 'hl.dsp.dpms({ action = "on" })'
}

# 10 minutes -> lock. Matches GNOME's lock-delay of 300s after blanking.
listener {
    timeout = 600
    on-timeout = loginctl lock-session
}

# Deliberately no suspend listener: sleep-inactive-ac-type was 'nothing'.
