Skip to content

Instantly share code, notes, and snippets.

@Gen2ly
Created June 1, 2012 02:29
Show Gist options
  • Save Gen2ly/2848180 to your computer and use it in GitHub Desktop.
Save Gen2ly/2848180 to your computer and use it in GitHub Desktop.
Change Logitech G9 mouse led color to random color after specified period
#!/bin/bash
# Change Logitech G9 mouse led color to random color after specified period
# Minutes until change
minutes=10
MINUTES=$(($minutes*60))
# Generic array of colors
color=(000033 000066 000099 003300 006600 00CC00 00FF33 330000 330033 330066
333300 336600 33CC33 33FF00 33FF33 660000 660033 6600CC 6600FF 66FF00 66FF33
99FF00 99FF33 CC3300 CCCC00 CCFF00 CCFF33 FF0000 FF0033 FF0066 FF0099 FF3300
FF3333 FF6600 FF6633 FFFF00)
# Run g9led and insert random color every $minutes
while true; do
sudo g9led ${color[$((RANDOM %= $((${#color[@]}))))]}
sleep "$MINUTES"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment