Table of Contents
Quick Guide
- Get and install nagisa’s msi-rgb utlity for msi motherboards.
- OpenRGB is an alternative solution and supports more motherboards.
- Turn off by running ‘
sudo /home/amigo/msi-rgb/target/release/msi-rgb -x 00000000 00000000 00000000
‘. - Use crontab to turn off after boot.
- Create a shell script in /lib/systemd/system-sleep/ to turn off after resume.
Install msi-rgb
nagisa has written a small utility to control the rgb on msi motherboard. For others, use Adam Honse’s OpenRGB instead.
Use git to download from GitHub: ‘git clone https://github.com/nagisa/msi-rgb
‘
It’s written in rust. Beforce build, setup the development environment by running ‘curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
‘. The Getting started page explains a small sample project and the build process.
To uninstall, run ‘rustup self uninstall
‘.
Change to the msi-rgb directory and run ‘cargo build --release
‘ to build th project.
The executible file is /home/amigo/msi-rgb/target/release/msi-rgb.
Turn Off Immediatedly
It can change the color with assigned delay time. I just want to turn them off forever:
sudo /home/amigo/msi-rgb/target/release/msi-rgb -x 00000000 00000000 00000000
The flag ‘-x
‘ is to turn off. Because it cannot run without the three red-green-blue hex values, any would be fine.
‘msi-rgb -h
‘ shows more control options.
Turn Off on Start
Edit the root’s crontab file to run at start:
$sudo crontab -e
Add a task to run msi-rgb after each reboot:
@reboot sudo /home/amigo/msi-rgb/target/release/msi-rgb -x 00000000 00000000 00000000
The led will be turned off before login.
Turn Off After Resume
Create a script in /lib/systemd/system-sleep/ on Ubuntu 20.04 LTS to be executed after resume. The location might be different on different version and distribution.
$sudo vi /lib/systemd/system-sleep/turn-off-rgb-after-resume.sh
...
#!/bin/bash
#
# located in /lib/systemd/system-sleep/
# Created 2021/5/6
# pre - before resume
# post - after resume
case "${1}" in
post)
su root -c "/home/amigo/msi-rgb/target/release/msi-rgb -x 00000000 00000000 00000000"
break
;;
esac
...
$sudo chmod 744 turn-off-rgb-after-resume.sh
Reference
- reddit: How to disable MSI RGB LED without Mystic Light
- GitHub: nagisa / msi-rgb
- GitLab: Adam Honse / OpenRGB
- Rust: Getting started
- Rust: Install Rust
- Chron: How to Run a Command on Startup in Linux
- Computer Hope: Linux crontab command
- ask ubuntu: how to execute a command after resume from suspend?
- Shell Scripting Tutorial: Case
- Style Guide