#!/bin/bash

# omarchy:summary=Apply the current theme keyboard color to ASUS ROG keyboards
# omarchy:hidden=true

ASUSCTL_THEME=$HOME/.local/state/omarchy/current/theme/keyboard.rgb

if omarchy-cmd-present asusctl && [[ -f $ASUSCTL_THEME ]]; then
  color=$(sed 's/^#//' "$ASUSCTL_THEME")
  [[ $color =~ ^[0-9A-Fa-f]{6}$ ]] || exit 0
  asusctl aura effect static -c "$color"
fi
