Automating OpenRGB Profile Application On Startup (For Linux)
Writing this post as a how to guide for users to be able to get automated setting of RGB components to work as a workaround for two issues:
- Certain devices RGB doesn't persist on reboot. For me this was the case for my cpu fan and ram
- Profiles fail to retain saved values for certain devices on reboot. For me it was again an issue with my ram.
If neither of these issues apply to your specific setup, this guide probably won't be as relevant to you.
Steps:
- Create a directory called /ProfileLoaders in the /OpenRGB project directory
- For each desired color profile created a script in the ProfileLoaders directory (LoadProfile-{color}.sh) the contents of which should be a cli command that colors each device individually. (This is to get around the aforementioned issue where profiles don't always seem to retain the settings you save for certain rgb components after reboot) Example script contents:
# Navigate to OpenRGB project and run a profile along with setting color for a non-persistent device
cd absolutePathToOpenRGB && ./OpenRGB -p Green.orp && ./OpenRGB -d 0 -m Static -c "00ff00"
- In that same ProfileLoaders directory create a LoadProfile-LastUsed.sh file which is empty
- In your ~/.bashrc create a bash function that enables you to run a command that looks like this:
apply-pc-color {color}This command will first run the script for the referenced color in the LoadProfiles directory to change your rgb colors, then it will overwrite the contents of the LoadProfile-LastUsed.sh file with a bash command to run this same LoadProfile-{color}.sh that was run previously. The lines to add to your ~/.bashrc file:
apply-pc-color() {
# Loads desired profile
bash "pathToOpenRGB/ProfileLoaders/LoadProfile-$1.sh"
# Sets the LastUsed profile to the profile used in the above command for use on automatic startup
echo "#!/bin/bash" > pathToOpenRGB/ProfileLoaders/LoadProfile-LastUsed.sh
echo "bash pathToOpenRGB/ProfileLoaders/LoadProfile-$1.sh" >> pathToOpenRGB/OpenRGB/ProfileLoaders/LoadProfile-LastUsed.sh
}
- Add these lines to your .bash_profile which runs the LoadProfile-LastUsed.sh in the background on startup:
# Loads last used profile in the background and redirects output so it's not shown on console being used
bash pathToOpenRGB/ProfileLoaders/LoadProfile-LastUsed.sh > /dev/null &