Skip to content

Instantly share code, notes, and snippets.

@banasiak
Last active August 29, 2015 14:13
Show Gist options
  • Save banasiak/9c366f3a755f70fa4896 to your computer and use it in GitHub Desktop.
Save banasiak/9c366f3a755f70fa4896 to your computer and use it in GitHub Desktop.
Bash script for changing colors using Boblight
#!/bin/bash
export DISPLAY=:0.0
PID_FILE="/opt/boblight-control/blc.pid"
kill_pid() {
if [ -e "$PID_FILE" ]
then
PID=$(<"$PID_FILE")
echo "Killing $PID"
kill $PID
rm $PID_FILE
else
echo "$PID_FILE doesn't exist"
fi
}
case $1 in
'red')
echo "RED"
kill_pid
/usr/local/bin/boblight-constant FF0000 &
echo $! > $PID_FILE
;;
'green')
echo "RED"
kill_pid
/usr/local/bin/boblight-constant 00FF00 &
echo $! > $PID_FILE
;;
'blue')
echo "WHITE"
kill_pid
/usr/local/bin/boblight-constant 0000FF &
echo $! > $PID_FILE
;;
'white')
echo "RED"
kill_pid
/usr/local/bin/boblight-constant FFFFFF &
echo $! > $PID_FILE
;;
'dynamic')
echo "DYNAMIC"
kill_pid
boblight-X11 -o saturation=1.1 -o value=2 -o threshold=20 -o interpolation=1 -o speed=50 &
echo $! > $PID_FILE
;;
'stop')
echo "STOP"
kill_pid
;;
*)
echo "NO ARGS"
;;
esac
exit $?
# LIRCRC Auto Generated by Mythbuntu Lirc Generator
# Author(s): Mario Limonciello, Nick Fox, John Baab
# Created for use with Mythbuntu
begin
remote = mceusb_hauppauge
prog = mythtv
button = Stop
config = Escape
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Record
config = R
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Pause
config = P
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Play
config = P
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Rewind
config = <
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Replay
config = Q
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Skip
config = Z
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Back
config = Escape
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = More
config = I
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Up
config = Up
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Left
config = Left
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Right
config = Right
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = OK
config = Return
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Down
config = Down
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = VolUp
config = ]
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = VolDown
config = [
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Home
config = M
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = ChanDown
config = Down
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = ChanUp
config = Up
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Mute
config = |
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = RecTV
config = R
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Guide
config = S
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = One
config = 1
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Two
config = 2
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Three
config = 3
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Four
config = 4
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Five
config = 5
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Six
config = 6
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Seven
config = 7
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Eight
config = 8
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Nine
config = 9
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Zero
config = 0
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Hash
config = D
repeat = 0
delay = 0
end
begin
remote = mceusb_hauppauge
prog = mythtv
button = Enter
config = Return
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Rec
config = R
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Pause
config = P
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Stop
config = Escape
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Skipback
config = Z
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Play
config = P
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Skipfwd
config = Right
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Fwd
config = >
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Start
config = Return
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Back
config = Escape
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = More
config = I
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Volup
config = ]
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Voldown
config = [
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Chup
config = Up
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Chdown
config = Down
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Up
config = Up
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Down
config = Down
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Left
config = Left
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Right
config = Right
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Mute
config = |
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Rectv
config = R
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Guide
config = S
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Dvdmenu
config = M
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = 1
config = 1
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = 2
config = 2
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = 3
config = 3
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = 4
config = 4
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = 5
config = 5
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = 6
config = 6
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = 7
config = 7
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = 8
config = 8
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = 9
config = 9
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = 0
config = 0
repeat = 0
delay = 0
end
begin
remote = vista_mce
prog = mythtv
button = Enter
config = Return
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = PlayPause
config = P
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = RecTV
config = R
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = Guide
config = S
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_BACK
config = Escape
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_OK
config = Return
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_RIGHT
config = Right
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_LEFT
config = Left
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_DOWN
config = Down
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_UP
config = Up
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = Hash
config = D
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_AGAIN
config = Q
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_NEXT
config = Z
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_STOP
config = Escape
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_PAUSE
config = P
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_RECORD
config = R
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_PLAY
config = P
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_REWIND
config = <
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_FORWARD
config = >
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_CHANNELDOWN
config = Down
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_CHANNELUP
config = Up
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_VOLUMEDOWN
config = [
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_VOLUMEUP
config = ]
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = More
config = I
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_MUTE
config = |
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_HOME
config = M
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_ENTER
config = Return
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_9
config = 9
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_8
config = 8
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_7
config = 7
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_6
config = 6
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_5
config = 5
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_4
config = 4
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_3
config = 3
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_2
config = 2
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_1
config = 1
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = mythtv
button = KEY_0
config = 0
repeat = 0
delay = 0
end
begin
remote = mceusb
prog = irexec
button = KEY_RED
repeat = 0
config = /opt/boblight-control/blc red
end
begin
remote = mceusb
prog = irexec
button = KEY_GREEN
repeat = 0
config = /opt/boblight-control/blc green
end
begin
remote = mceusb
prog = irexec
button = KEY_YELLOW
repeat = 0
config = /opt/boblight-control/blc white
end
begin
remote = mceusb
prog = irexec
button = KEY_BLUE
repeat = 0
config = /opt/boblight-control/blc blue
end
begin
remote = mceusb
prog = irexec
button = KEY_CLEAR
repeat = 0
config = /opt/boblight-control/blc stop
end
begin
remote = mceusb
prog = irexec
button = KEY_POWER
repeat = 0
config = /opt/boblight-control/blc stop; sudo shutdown -h now
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment