Skip to content

Instantly share code, notes, and snippets.

@dpanter
Created August 28, 2021 11:14
Show Gist options
  • Save dpanter/ecb042f9a4a9932fa5643be0c07e13c6 to your computer and use it in GitHub Desktop.
Save dpanter/ecb042f9a4a9932fa5643be0c07e13c6 to your computer and use it in GitHub Desktop.
keyb_rgbsaver.sh - Auto load OpenRGB profiles with xscreensaver
#!/bin/bash
# keyb_rgbsaver.sh
# Automatically mute keyboard RGB when xscreensaver activates, turn back up when deactivating
# Created 2021-08-28
# Written for Siduction (Debian sid based distro)
# By dpanter https://gist.github.com/dpanter
# Requires _xscreensaver_ and _openrgb_
process() {
while read input; do
case "$input" in
# Double openrgb commands needed, sometimes openrgb turns off the keyboard RGB completely
# UNBLANK profile is very bright, the other is 5% brightness
UNBLANK*) /usr/bin/openrgb -p red-blue.orp && sleep 5 && /usr/bin/openrgb -p red-blue.orp;;
BLANK*) /usr/bin/openrgb -p red-blue2.orp && sleep 5 && /usr/bin/openrgb -p red-blue2.orp;;
RUN*) /usr/bin/openrgb -p red-blue2.orp && sleep 5 && /usr/bin/openrgb -p red-blue2.orp;;
LOCK*) /usr/bin/openrgb -p red-blue2.orp && sleep 5 && /usr/bin/openrgb -p red-blue2.orp;;
esac
done
}
/usr/bin/xscreensaver-command -watch | process
# Reference: https://bbs.archlinux.org/viewtopic.php?pid=1182514
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment