{{- $tags := .chezmoi.config.data.tags -}}
### based on the example config from hyprland.org

general {
    lock_cmd = pgrep -x hyprlock >/dev/null || hyprlock   # avoid starting multiple hyprlock instances.
    before_sleep_cmd = loginctl lock-session    # lock before suspend.
    after_sleep_cmd = hyprctl dispatch 'hl.dsp.dpms({ action = "enable" })'  # to avoid having to press a key twice to turn on the display.
    ignore_dbus_inhibit = false                 # whether to ignore dbus-sent idle-inhibit requests (used by e.g. firefox or steam)
    ignore_systemd_inhibit = false              # whether to ignore systemd-inhibit --what=idle inhibitors
}

{{ if index $tags "laptop" -}}
# Laptop: aggressive timeouts to save battery.
listener {
    timeout = 180                                 # 3min
    on-timeout = hyprctl dispatch 'hl.dsp.dpms({ action = "disable" })'        # screen off
    on-resume = hyprctl dispatch 'hl.dsp.dpms({ action = "enable" })'
}

listener {
    timeout = 360                                 # 6min
    on-timeout = loginctl lock-session            # lock screen
}

listener {
    timeout = 900                                 # 15min
    on-timeout = systemctl suspend                # suspend
}
{{- else -}}
# Desktop: relaxed timeouts.
listener {
    timeout = 300                                 # 5min
    on-timeout = hyprctl dispatch 'hl.dsp.dpms({ action = "disable" })'        # screen off when timeout has passed
    on-resume = hyprctl dispatch 'hl.dsp.dpms({ action = "enable" })'          # screen on when activity is detected after timeout has fired.
}

listener {
    timeout = 600                                 # 10min
    on-timeout = loginctl lock-session            # lock screen when timeout has passed
}

listener {
    timeout = 1200                                # 20min
    on-timeout = systemctl suspend                # suspend pc
}
{{- end }}
