diff --git a/dot_config/hypr/executable_lights.sh b/dot_config/hypr/executable_lights.sh index 7c65052..3e7cad9 100644 --- a/dot_config/hypr/executable_lights.sh +++ b/dot_config/hypr/executable_lights.sh @@ -1 +1,59 @@ -echo test +#!/usr/bin/env bash + +# --- CONFIGURATION --- +# OpenRGB +PROFILE_OFF="off" +PROFILE_ON="on" +# CoolerControl API settings +API_URL="http://localhost:11987" +MODE_ON="5fd7eba6-b519-4cc6-8f21-a239357c8bda" +MODE_OFF="1b781fa9-b1dc-4467-bd52-e04c981c6dee" +# --------------------- + +apply_mode() { + local mode_id=$1 + echo "Applying CoolerControl Mode: $mode_id" + curl -s -X POST "$API_URL/modes/apply" \ + -H "Content-Type: application/json" \ + -d "{\"id\": \"$mode_id\"}" > /dev/null +} + +lights_off() { + echo "Turning Lights Off" + + # 1. Apply CoolerControl "Off" Mode + apply_mode "$MODE_OFF" + + # 2. Kill RGB + echo "Applying OpenRGB Profile: $PROFILE_OFF" + openrgb --profile "$PROFILE_OFF" > /dev/null 2>&1 +} + +lights_on() { + echo "Turning Lights Back On" + + # 1. Apply CoolerControl "On" Mode + apply_mode "$MODE_ON" + + # 2. Restore RGB + echo "Applying OpenRGB Profile: $PROFILE_ON" + openrgb --profile "$PROFILE_ON" > /dev/null 2>&1 +} + + +case "$1" in + off) + lights_off + ;; + on) + lights_on + ;; + -h|--help|*) + echo "Usage: $(basename "$0") [on|off]" + echo "" + echo "Commands:" + echo " off Kill RGB and apply CoolerControl '$MODE_OFF'" + echo " on Restore RGB and apply CoolerControl '$MODE_ON'" + exit 0 + ;; +esac diff --git a/dot_config/hypr/hypridle.conf b/dot_config/hypr/hypridle.conf index aca3ed3..266c05c 100644 --- a/dot_config/hypr/hypridle.conf +++ b/dot_config/hypr/hypridle.conf @@ -19,6 +19,6 @@ listener { listener { timeout = 330 # in seconds - on-timeout = /home/user/.config/hypr/lights.sh off - on-resume = /home/user/.config/hypr/lights.sh on + on-timeout = ~/.config/hypr/lights.sh off + on-resume = ~/.config/hypr/lights.sh on }