#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2024 ROCNIX (https://github.com/archr-linux/Arch-R)

# Restore LED state that was saved prior to device sleep

. /etc/profile

### Get the current LED state and store it
SLEEP_LED_STATE=$(get_setting "sleep.led.color")
if [ ! -n "${SLEEP_LED_STATE}" ]; then
  SLEEP_LED_STATE="battery"
  set_setting "sleep.led.color" "battery"
fi

### Turn on LEDS
/usr/bin/ledcontrol ${SLEEP_LED_STATE}
