Created
December 30, 2015 04:20
-
-
Save jacobmischka/7f96f3fddf93dbe21db2 to your computer and use it in GitHub Desktop.
Changes color for ds4 controller lightbar on linux and gives permissions so games can change it too if they support it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This isn't really that safe to blindly run, | |
# as it uses sudo to change system file permissions. | |
# Hopefully it shouldn't break anything though. | |
# Usage: ds4led [r value] [g value] [b value] | |
# or `ds4led orange` to set it to orange. | |
DS4="0003:054C:05C4.*" | |
cd /sys/class/leds | |
FILES=("$DS4:*/brightness") | |
for FILE in $FILES; do | |
if [[ $(stat -c "%a" $FILE) != 777 ]]; then | |
sudo chmod 777 $FILE | |
fi | |
done | |
if [[ $# > 0 ]]; then | |
if [[ "$1" -eq "orange" ]]; then | |
echo 150 > $DS4:red/brightness | |
echo 50 > $DS4:green/brightness | |
echo 0 > $DS4:blue/brightness | |
else | |
echo $1 > $DS4:red/brightness | |
fi | |
fi | |
if [[ $# > 1 ]]; then | |
echo $2 > $DS4:green/brightness | |
fi | |
if [[ $# > 2 ]]; then | |
echo $3 > $DS4:blue/brightness | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment